summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp2
-rw-r--r--src/widgets/widgets/qmenubar.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp
index fb0705c8c7..b13c875854 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp
@@ -120,7 +120,7 @@ void QDBusMenuBar::syncMenu(QPlatformMenu *menu)
void QDBusMenuBar::handleReparent(QWindow *newParentWindow)
{
- if (newParentWindow && newParentWindow->winId() != m_windowId) {
+ if (newParentWindow) {
unregisterMenuBar();
m_windowId = newParentWindow->winId();
registerMenuBar();
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 2588f41468..b2ec8f2c08 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1474,6 +1474,17 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event)
}
}
+ if (isNativeMenuBar() && event->type() == QEvent::ShowToParent) {
+ // On some desktops like Unity, the D-Bus menu bar is unregistered
+ // when the window is hidden. So when the window is shown, we need
+ // to forcefully re-register it. The only way to force re-registering
+ // with D-Bus menu is the handleReparent method.
+ QWidget *widget = qobject_cast<QWidget *>(object);
+ QWindow *handle = widget ? widget->windowHandle() : nullptr;
+ if (handle != nullptr)
+ d->platformMenuBar->handleReparent(handle);
+ }
+
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) {
if (d->altPressed) {
switch (event->type()) {