Important: Please read the Qt Code of Conduct -

QAction problem

  • Hi,

    in my mainwindow.ui I added a new QAction "actionExit", but when i try connect signal to slot like that:

    connect(actionExit, SIGNAL(triggered()), this, SLOT(quit()));

    I get an error during compilation

    'actionExit' was not declared in this scope

    What can I do to make the actionExit object visible in mainwindow?

  • It is in the ui file, not in the class.
    So you need to use


    in mainwindow.cpp

Log in to reply