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
#-------------------------------------------------
#
# Project created by QtCreator 2012-08-21T18:03:11
#
#-------------------------------------------------
QT += core gui
#The follow line appears with Qt 4.8.2
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
CONFIG += release
MOC_DIR = ./moc/
RCC_DIR = ./qrc/
OBJECTS_DIR = ./obj/
DESTDIR = ./
TARGET = Test
SOURCES += main.cpp
HEADERS +=
RESOURCES += ressources.qrc
#-------------------------------------------------
#
# Project created by QtCreator 2012-08-21T18:03:11
#
#-------------------------------------------------
QT += core gui
#The follow line appears with Qt 4.8.2
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
CONFIG += release
MOC_DIR = ./moc/
RCC_DIR = ./qrc/
OBJECTS_DIR = ./obj/
DESTDIR = ./
TARGET = Test
SOURCES += main.cpp
HEADERS +=
RESOURCES += ressources.qrc
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QApplication>
#include <QTabWidget>
#include <QTextEdit>
#include <QCalendarWidget>
int main(int argc, char *argv[])
{
tabWidget.setMovable(true);
tabWidget.
addTab(&textEdit,
QIcon(":/Desktop.png"),
"Text edit");
tabWidget.
addTab(&calendarWidget,
QIcon(":/Star.png"),
"Calendar widget");
tabWidget.show();
return a.exec();
}
#include <QApplication>
#include <QTabWidget>
#include <QTextEdit>
#include <QCalendarWidget>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTabWidget tabWidget;
tabWidget.setMovable(true);
QTextEdit textEdit;
tabWidget.addTab(&textEdit, QIcon(":/Desktop.png"), "Text edit");
QCalendarWidget calendarWidget;
tabWidget.addTab(&calendarWidget, QIcon(":/Star.png"), "Calendar widget");
tabWidget.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
resources.qrc
<RCC>
<qresource>
<file>Desktop.png</file>
<file>Star.png</file>
</qresource>
</RCC>
<RCC>
<qresource>
<file>Desktop.png</file>
<file>Star.png</file>
</qresource>
</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
Bookmarks