[Solved] No access to qApp



  • I've got a pretty simple application, but I'm not able to see the global variable, qApp. My main function is very simple:
    @
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
    

    }
    @

    Then, inside the constructor of w (a QMainWindow) I'm trying to set up a translation and have the line:
    @
    qApp->installTranslator(.....
    @

    It tells me that qApp has not been declared in this scope. I thought it was automatically declared without me having to do anything. Why can't I access it?


  • Moderators

    add @#include <QApplication>@ in your MainWindow class. qApp is available wherever it is included.



  • Knew it had to be something simple - Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.