summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-28 11:13:44 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-03-28 11:13:44 +0000
commit5d3b27f5210c0bac16e1bca7aacab39444556392 (patch)
treedffa43c01d431289afa5e1a7722b4d1896341a19 /src/widgets/widgets
parent95b3ea08f84c2a9bb39179a46952982501c2b2e8 (diff)
parente52eb747b1d1c3026fed39e833c0c7365a8d5117 (diff)
Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qmenubar.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 77ed7a4f78..c16b2a5ac1 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1470,6 +1470,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()) {