Fix parent widget of "Lock qBittorrent" submenu

The parent widget of lockMenu is going to be used to derive the
transient parent window. Currently the parent widget of lockMenu is
the main window, therefore the main window is also going to be the
transient parent for lockMenu's window handle.

In other words, the "View" menu and "Lock qBittorrent" menu are
going to be considered as siblings by the window manager even though
the latter is nested inside the former.

On platforms like wayland, such popup hierarchies are illegal, popups
must be properly nested. qtwayland works around it, but it also prints
warning messages.

This change makes lockMenu a child of the view menu so they are
properly nested from the window manager point of view.

PR #19967.
Closes #19955.
This commit is contained in:
Vlad Zahorodnii 2023-11-20 19:39:21 +02:00 committed by Vladimir Golovnev (Glassez)
parent a57b80c7e0
commit 18ad861444
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7

View file

@ -174,7 +174,7 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
m_ui->menuLog->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_s));
m_ui->actionCheckForUpdates->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
auto *lockMenu = new QMenu(this);
auto *lockMenu = new QMenu(m_ui->menuView);
lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword);
lockMenu->addAction(tr("&Clear Password"), this, &MainWindow::clearUILockPassword);
m_ui->actionLock->setMenu(lockMenu);