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

qt.qpa.wayland: wrong transient parent of the popup

    XMLWordPrintable

Details

    • Linux/Wayland
    • b29531aa9 (dev), 97043d254 (6.10), 3be734b0d (6.9)

    Description

      If you plug an QAction with a set menu into different menus, you will get:

      qt.qpa.wayland: Creating a popup with a parent, QWidgetWindow(0x55613181efd0, name="QMainWindowClassWindow") which does not match the current topmost grabbing popup, QWidgetWindow(0x5561325ddca0, name="QMenuClassWindow") With some shell surface protocols, this is not allowed. The wayland QPA plugin is currently handling it by setting the parent to the topmost grabbing popup. Note, however, that this may cause positioning errors and popups closing unxpectedly. Please fix the transient parent of the popup.
      

      Simple test application to trigger that below, to get the message, trigger both actions in the two top level menus alternating.

      /*
       *  SPDX-FileCopyrightText: 2025 Christoph Cullmann <cullmann@kde.org>
       *
       *  SPDX-License-Identifier: MIT
       */
      
      #include <QApplication>
      #include <QMainWindow>
      #include <QMenu>
      #include <QMenuBar>
      #include <QAction>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          QMainWindow test;
      
          auto m = new QMenuBar(&test);
          test.setMenuBar(m);
      
          auto s = m->addMenu(QStringLiteral("testm"));
          auto s2 = m->addMenu(QStringLiteral("testm2"));
      
          QAction *a = new QAction(QStringLiteral("test"), &test);
          s->addAction(a);
          s2->addAction(a);
          a->setMenu(new QMenu());
      
          a->menu()->addAction(QStringLiteral("test"));
      
          test.show();
      
          return app.exec();
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            zzag Vlad Zahorodnii
            christophcullmann Christoph Cullmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes