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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9
    • QPA: Wayland
    • None
    • Linux/Wayland

    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

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change