[Qt-interest] QWidget: Must construct a QApplication before a QPaintDevice

kai.koehne at nokia.com kai.koehne at nokia.com
Mon Sep 5 16:32:20 CEST 2011



> -----Original Message-----
> From: qt-interest-bounces+kai.koehne=nokia.com at qt.nokia.com [mailto:qt-
> interest-bounces+kai.koehne=nokia.com at qt.nokia.com] On Behalf Of ext
> Yifei Li
> Sent: Monday, September 05, 2011 4:00 PM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] QWidget: Must construct a QApplication before a
> QPaintDevice
> 
> Hi all,
> 
> I got this error when running an application (once working with Qt-4.6.2 on
> Snow Leopard) after I switch to Qt-4.8.0 on Lion.
> 
> The error occurs when I construct a QWidget in a plugin loaded by the main
> application. My application works as follows:
> 
> void main()
> {
>      QApplication app();
> 
>     // in Core's constructor, plugins are loaded using QPluginLoader
>      Core core;
> 
>     return app.exec();
> }
> 
> Any idea how to solve this? Thanks

You can do something along the lines of:

{
      QApplication app();
     // plugins are loaded in Core::load()
     Core core;
     QTimer::singleShot(0, &core, SLOT(load());
     return app.exec();
}

Regards

Kai

> Yifei
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list