Open new Window directly from Menubar

  • Hey there,
    new here and not that long into C++ and especially QT.
    I searched some time, but couldn't find an answer, that related to my problem:

    I want to open a new window directly from a button (QMenu) in the menubar, not by choosing QAction in a dropdown list.

    I tried this like I would with a QAction in the dropdown list but when I click on the button, nothing happens except that the button appears 'clicked'.
    connect(ui->menuBenchmark, SIGNAL(triggered(QAction*)), this, SLOT(benchmark()));
    // menuBenchmark is of type QMenu

    void MainWindow::benchmark()
    BenchmarkWindow* window = new BenchmarkWindow();

    I don't get any errors so I really don't know what I'm doing wrong or what equivalent I should use for QMenu instead of QAction.
    The window itself opens fine when I call it from a dropdown list, so I guess there's something wrong with connect and QMenu.

    Hope, someone can help me with this.

Log in to reply

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