Results 1 to 12 of 12

Thread: Qt resources system don't work for a simple example

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt resources system don't work for a simple example

    Hey guys,

    Since I have installed Qt 4.8.2, I can't use the Qt system resources because the resources are not compiled during compilation. Maybe is there another feature to be activated now ? I work with Qt 4.8.2 on Windows Vista and I don't try yet if I have the same problem in my Linux system. For information, I have download the Qt libraries 4.8.2 for Windows (minGW 4.4, 318 MB) and Qt Creator 2.5.2 for Windows (30 MB) on Nokia downloads page.

    Here is my simple example :

    Test.pro
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-08-21T18:03:11
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. #The follow line appears with Qt 4.8.2
    10. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    11.  
    12. TEMPLATE = app
    13. CONFIG += release
    14. MOC_DIR = ./moc/
    15. RCC_DIR = ./qrc/
    16. OBJECTS_DIR = ./obj/
    17. DESTDIR = ./
    18. TARGET = Test
    19.  
    20. SOURCES += main.cpp
    21.  
    22. HEADERS +=
    23.  
    24. RESOURCES += ressources.qrc
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include <QTabWidget>
    3. #include <QTextEdit>
    4. #include <QCalendarWidget>
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9.  
    10. QTabWidget tabWidget;
    11.  
    12. tabWidget.setMovable(true);
    13.  
    14. QTextEdit textEdit;
    15. tabWidget.addTab(&textEdit, QIcon(":/Desktop.png"), "Text edit");
    16. QCalendarWidget calendarWidget;
    17. tabWidget.addTab(&calendarWidget, QIcon(":/Star.png"), "Calendar widget");
    18.  
    19. tabWidget.show();
    20.  
    21. return a.exec();
    22. }
    To copy to clipboard, switch view to plain text mode 

    resources.qrc
    Qt Code:
    1. <RCC>
    2. <qresource>
    3. <file>Desktop.png</file>
    4. <file>Star.png</file>
    5. </qresource>
    6. </RCC>
    To copy to clipboard, switch view to plain text mode 

    The .pro, .cpp, .qrc and .png files are in the same location of course.
    Finally, images doesn't appear during execution because they can't be loaded.

    During compilation when I used Qt 4.8.0, these commands appeared :

    rcc -name ressources ressources.qrc -o qrc\qrc_ressources.cpp
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
    -DNDEBUG -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX
    -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT
    -DQT_NEEDS_QMAIN -I'd:/Applis/Qt/4.8.2/include/QtCore' -I'd:/Applis/Qt/4.8.2/include/QtGui'
    -I'd:/Applis/Qt/4.8.2/include' -I'.' -I'd:/Applis/Qt/4.8.2/include/ActiveQt' -I'./moc'
    -I'd:/Applis/Qt/4.8.2/mkspecs/win32-g++' -o ./qrc_ressources.o ./qrc/qrc_ressources.cpp

    And of course, the generated .o file was added during the executable creation.

    Have you any idea ?

    Regards,

    P'tit Ju
    Last edited by P'tit Ju; 24th August 2012 at 11:11.

Similar Threads

  1. QIcons, sharing system resources on Windows
    By markfinal in forum Qt Programming
    Replies: 0
    Last Post: 24th August 2010, 12:04
  2. Replies: 3
    Last Post: 15th February 2010, 11:44
  3. Replies: 12
    Last Post: 5th July 2009, 16:03
  4. surprise why this simple statement doesnt work
    By salmanmanekia in forum Qt Programming
    Replies: 6
    Last Post: 28th July 2008, 12:42
  5. QHttp simple program doesn't work
    By johncharlesb in forum Qt Programming
    Replies: 0
    Last Post: 4th April 2008, 04:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.