Results 1 to 16 of 16

Thread: must construct QApplication before constructing QPaintDevice

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    Is there anything else that can cause this error?

    I am using this bash script (http://qtcentre.org/forum/f-qt-progr...ighlight=qtxml) which embeds 4 Qt frameworks into the app and makes it into a dmg file, and once I do that, I receive this error. Before I embed the frameworks I do not get this error.

    I can't seem to find any other reason why it would be caused. If anyone has any ideas let me know.
    thanks for the help,
    dave

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    You surely have some global object somewhere which is created before QApplication.

  3. #3
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    so that means that it must be outside of any class definition? I really can't find it. Why would it work before embedding the frameworks though?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    I have no idea. I don't even know why you use that script. AFAIK Qt can create bundles by itself.

  5. #5
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    I've never seen anything on the Qt documentation about making dmg's. I found the script here originally:

    http://qtnode.net/wiki/Distributing_Mac_Qt_applications

    The script even says the guy who created it doesn't use it anymore, but I've never found a better way to do it. Do you have any suggestions. All I really need it for is to embed the QtCore, QtXml, QtOpenGL, and QtGui frameworks into my .app.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    http://doc.trolltech.com/latest/deployment-mac.html

    Anyway that's not the issue here. There is something wrong with your code.

  7. #7
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    I really don't see anything wrong with it. Will it definitely have the word static in it? The code is way too large to post up here, so I guess I'll just keep looking. I don't understand why it works with the absolute paths to the libraries, but not with the relative paths.

    One thing I noticed that this script does that seems strange is in the results of

    otool -L

    before the script
    Qt Code:
    1. /Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0)
    2. /Library/Frameworks/3DconnexionClient.framework/Versions/A/3DconnexionClient (compatibility version 1.0.0, current version 1.0.0)
    3. /usr/local/Trolltech/Qt-4.3.0beta/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.3.0, current version 4.3.0)
    4. /usr/local/Trolltech/Qt-4.3.0beta/lib/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.3.0, current version 4.3.0)
    5. /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 12.0.0)
    6. /usr/local/Trolltech/Qt-4.3.0beta/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.3.0, current version 4.3.0)
    7. /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    8. /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0)
    9. /usr/local/Trolltech/Qt-4.3.0beta/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.3.0, current version 4.3.0)
    10. /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    11. /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6)
    12. /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
    13. /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
    14. /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    15. /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    16. /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    17. /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    To copy to clipboard, switch view to plain text mode 

    after the script
    Qt Code:
    1. /Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0)
    2. /Library/Frameworks/3DconnexionClient.framework/Versions/A/3DconnexionClient (compatibility version 1.0.0, current version 1.0.0)
    3. @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml (compatibility version 4.3.0, current version 4.3.0)
    4. @executable_path/../Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.3.0, current version 4.3.0)
    5. /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 12.0.0)
    6. @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.3.0, current version 4.3.0)
    7. /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
    8. /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0)
    9. @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.3.0, current version 4.3.0)
    10. /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    11. /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6)
    12. /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
    13. /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
    14. /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    15. /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    16. /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    17. /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    To copy to clipboard, switch view to plain text mode 

    saying @executable_path seems wrong, but I don't really know enough about it to know whether that's right or not.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    No, the object doesn't have to be static. It's enough if it's global. Maybe your Qt installation is somehow broken?

  9. #9
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    it's 4.3 beta, but 4.2.3 had other errors that I couldn't figure out, and I found this post that said someone fixed the same errors I was having by upgrading to 4.3beta, so I did, and it fixed those errors, but gave me new ones.

    oh joy. i really appreciate all your help. Changing my app to Qt from fltk has been a rollercoaster ride so far. thanks again,
    dave

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    Try running your script on a dummy application and see if the problem persists. If so, this could mean a somehow invalid Qt installation or a problem with the script. But if it works, then surely the problem lies within your code.

  11. #11
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: must construct QApplication before constructing QPaintDevice

    I just tried on an example app , the 2dpainting opengl sample, and it did the same error. that's good to know. Now I just need to find a better script. Perhaps it's the order of the frameworks that I'm including that is the problem. I figured QtCore would need to be first...

    I will try a different script. Thanks for your help,
    dave

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: must construct QApplication before constructing QPaintDevice

    The script might be fine. If it's in the wiki then I assume it works for someone. The problem may lie in cooperation between the script and your Qt compilation.

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.