View Full Version : Q_init_resource
phillip_Qt
4th March 2008, 13:22
Hi All
I tried the example givein in http://doc.trolltech.com/4.2/widgets-stylesheet.html url.
But getting error LNK2019: unresolved external symbol "int __cdecl qInitResources_stylesheet(void) error for the line Q_INIT_RESOURCE(stylesheet) inside main.cpp. If i commented this line then its working fine. i cannt guess what is the wrong.
I need to change the colours of Buttons.. etc by using code like QPushButton { color: red }
QLineEdit { color: red }
QComboBox { color: red } given in http://doc.trolltech.com/4.2/stylesheet.html. url.
Can any body help me.?
Thank you all.
I tried the example givein in http://doc.trolltech.com/4.2/widgets-stylesheet.html url.
Notice that the same example is also shipped with Qt, including a suitable .pro file.
But getting error LNK2019: unresolved external symbol "int __cdecl qInitResources_stylesheet(void) error for the line Q_INIT_RESOURCE(stylesheet) inside main.cpp. If i commented this line then its working fine. i cannt guess what is the wrong.
Either you misnamed stylesheet.qrc or its completely missing from .pro (should be listed in the RESOURCES variable).
I need to change the colours of Buttons.. etc by using code like QPushButton { color: red }
QLineEdit { color: red }
QComboBox { color: red } given in http://doc.trolltech.com/4.2/stylesheet.html. url.
Can any body help me.?
See Qt 4.3 docs, they were improved quite a lot:
http://doc.trolltech.com/4.3/stylesheet-examples.html#customizing-a-qpushbutton-using-the-box-model
http://doc.trolltech.com/4.3/stylesheet-examples.html#customizing-qpushbutton
phillip_Qt
4th March 2008, 13:56
Hi. the qrc file name is stylesheet.qrc. But i cannt find the error. can u plz tell me where to add the following codes.
nameEdit->setStyleSheet("color: blue;"
"background-color: yellow;"
"selection-color: yellow;"
"selection-background-color: blue;");
Inside constructor or where?
Thanx. :(
phillip_Qt
5th March 2008, 05:28
Hi All
Now I'm able to get the widndow and change the colours too. But I ve commented out the Q_INIT_RESOURCE(stylesheet); line inside main.cpp in http://doc.trolltech.com/4.2/widgets-stylesheet.html . But i need to de comment this. If im de commenting this im getting the error main.obj : error LNK2001: unresolved external symbol "int __cdecl qInitResources_stylesheet(void)" (?qInitResources_stylesheet@@YAHXZ). Is it required to make the solution configure as dynamic.lib in stead of application.exe if we include Q_INIT_RESOURCE?
I need ur kind help.
Thanx.:(
You must have
RESOURCES += stylesheet.qrc
in your .pro file and then you must re-generate the Visual Studio project file. Or just grab the original .pro file from %QTDIR%/examples...
phillip_Qt
5th March 2008, 08:05
You must have
RESOURCES += stylesheet.qrc
in your .pro file and then you must re-generate the Visual Studio project file. Or just grab the original .pro file from %QTDIR%/examples...
Thank u very much. But can u please tell me where to add this command?:confused: If i'll add to .pro file and save it, it wort work i think. Im very new to this. so i need ur little help..
Thank You.
How did you create the Visual Studio project in the first place?
phillip_Qt
5th March 2008, 08:12
How did you create the Visual Studio project in the first place?
I opend a command prompt. and used the command qmake -project vc -tp and then qmake.
Any thing else i ve 2 do or i ve 2 create a new solution?
I opend a command prompt. and used the command qmake -project vc -tp and then qmake.
I suppose you mean "qmake -project" and "qmake -tp vc". Anyway, add the suggested line to the generated .pro file and repeat the latter step. OR as I said, simply get a proper .pro file from the examples directory.
phillip_Qt
5th March 2008, 10:33
I suppose you mean "qmake -project" and "qmake -tp vc". Anyway, add the suggested line to the generated .pro file and repeat the latter step. OR as I said, simply get a proper .pro file from the examples directory.
Thank You very much. I created a new solution and now its working perfecly.:)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.