Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118419

[Reg 6.4->6.5] Cannot create button with menu in message box

XMLWordPrintable

    • macOS
    • bed9ed55c (12.0), 2d59f2e8c (dev), a69980e55 (6.6), 95bda90a4 (tqtc/lts-6.5)

      Create a message box with two buttons, add a menu to one of the buttons

              auto *b = new QMessageBox;
              auto button = b->addButton("Open", QMessageBox::AcceptRole);
              b->addButton("Cancel", QMessageBox::RejectRole);
              auto menu = new QMenu;
              menu->addAction("Foo");
              menu->addAction("Bar");
              button->setMenu(menu);
              b->show();
      

      Expected: A message box opens with two buttons, one button with a menu that opens when I click the button without (yet) closing the message box.

      Actual: A message box opens with two buttons without menu, after clicking the "Open" button the message box closes and the menu appears "out of nothing".

      I'm aware that macOS native dialogs probably do not support this, but then Qt should automatically switch to a non-native dialog.
      This breaks existing application logic.

        For Gerrit Dashboard: QTBUG-118419
        # Subject Branch Project Status CR V

            tpochep Timur Pocheptsov
            con Eike Ziller
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: