Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Open new Window directly from Menubar
Qt 6.11 is out! See what's new in the release blog

Open new Window directly from Menubar

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 813 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Photatum
    wrote on last edited by
    #1

    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();
    window->show();
    }
    @

    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.
    Regards,
    Photo

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved