Results 1 to 2 of 2

Thread: why"QPixmap: Must construct a Qapplication before a QpaintDevice" only in Debug mode?

  1. #1
    Join Date
    Dec 2008
    Posts
    68

    Default why"QPixmap: Must construct a Qapplication before a QpaintDevice" only in Debug mode?

    Hello,

    I upgraded my application from Qt3.3 to Qt4.4. I have the following problem when the Qt4.4 program is running.

    - In release mode, it works fine;;

    - In debug mode, compilation and link is ok. However, when it runs, it pops up a error message:

    QPixmap: Must construct a Qapplication before a QpaintDevice.

    Following is the code in my main program and the error happened at :
    MainWindow smw;

    But I create QApplication before it already!

    - also, the release version can work ...

    Can anyone help me why this happened and how to solve it?

    thank you very much!




    Qt Code:
    1. int main( int argc, char ** argv )
    2. {
    3. try
    4. {
    5.  
    6. QApplication app( argc, argv );
    7.  
    8. MainWindow smw;
    9. app.setMainWidget( &smw );
    10. smw.hide();
    11.  
    12. ...
    13. }
    14. ...
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 8th January 2009 at 13:33. Reason: missing [code] tags

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

    Default Re: why"QPixmap: Must construct a Qapplication before a QpaintDevice" only in Debug m

    Probably there's a debug vs. release mismatch. Do you have some library that is compiled in release mode? That would explain why your application works in release mode but not in debug mode. Once you compile your application in debug mode, you should link against the debug version of that library.
    J-P Nurmi

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.