Results 1 to 10 of 10

Thread: Q_init_resource

  1. #1
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Q_init_resource

    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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_init_resource

    Quote Originally Posted by phillip_Qt View Post
    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:
    J-P Nurmi

  3. #3
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q_init_resource

    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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  4. #4
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q_init_resource

    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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_init_resource

    You must have
    Qt Code:
    1. RESOURCES += stylesheet.qrc
    To copy to clipboard, switch view to plain text mode 
    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...
    J-P Nurmi

  6. #6
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q_init_resource

    Quote Originally Posted by jpn View Post
    You must have
    Qt Code:
    1. RESOURCES += stylesheet.qrc
    To copy to clipboard, switch view to plain text mode 
    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? 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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_init_resource

    How did you create the Visual Studio project in the first place?
    J-P Nurmi

  8. #8
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q_init_resource

    Quote Originally Posted by jpn View Post
    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?
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_init_resource

    Quote Originally Posted by phillip_Qt View Post
    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.
    J-P Nurmi

  10. The following user says thank you to jpn for this useful post:

    phillip_Qt (5th March 2008)

  11. #10
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q_init_resource

    Quote Originally Posted by jpn View Post
    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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.