Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to provide interface with Qt



  • Using Qt class can make my work easier. I want to implement c++ interface with Qt class. But I get error:

    QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
    QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
    QPixmap: Must construct a QGuiApplication before a QPixmap
    Process finished with exit code -1073740791 (0xC0000409)
    

    My guess is that QApplication is needed if you want to use Qt class.
    Is there a way to use Qt class without GUI and QApplication?



  • @Yoline
    You need at least one inheritor of QCoreApplication, depending on what you use, to allow Qt infrastructure support. You can't use (the facilities you are trying to) without bothering to do this.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you want to use QPixmap you need to have at least a QGuiApplication created. The type of QXXXApplicstion object you need will depend on what you want to use.


Log in to reply