Menu

Error and crahs in simple application QWidget: Must construct a QApplication before a QWidget

Help
Qba10
2014-12-19
2015-01-07
  • Qba10

    Qba10 - 2014-12-19

    Hi

    I have very simple app with PythonQt

    int main(int argc, char *argv[]){
    
    
    QApplication a(argc, argv);
    PythonQt::init(PythonQt::IgnoreSiteModule );
    
    MainWindow w;
    PythonQtObjectPtr  mainContext = PythonQt::self()->getMainModule();
    PythonQt_QtAll::init();
    
    mainContext.evalScript("\
    from PythonQt.QtGui import * \n\
    print 'hello'; \
    group = QGroupBox() \
                              ");
    
    
    
    qDebug() << "Start Application";
    w.show();
    console.show();
    int result = a.exec();
     return result;
    

    When I add "group = QGroupBox()" i my python Script i get error QWidget: Must construct a QApplication before a QWidget and program crash
    What should I do ?

    I compiled PythonQt with:

    PythonQt2.1_Qt4.8 src
    Qt 5.3
    Python 2.7
    Windows 8.1
    mingw32

    }

     

    Last edit: Qba10 2014-12-19
  • Florian Link

    Florian Link - 2014-12-19

    That sounds strange. The PythonQt version that you mention does not support QT 5,
    so probably you are linking against either the wrong or both Qt versions. I would guess PythonQt with Qt 4 and your app with Qt 5.

    If you want Qt 5 support, you need to use the svn trunk of PythonQt, since Qt 5 support is not yet released as a zip file.

     
  • Qba10

    Qba10 - 2015-01-07

    Sorry my wrong.
    The last I used source from trunk revision 371.

    Edit

    Example PyGuiExample work on my computer

    Edit2

    It works when i build Application on Release
    Why it doesn't work on Debug ?

     

    Last edit: Qba10 2015-01-07

Log in to post a comment.