summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-17 16:33:14 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-18 12:09:16 (GMT)
commit6f55976270b22142da78b80abbebf018539587de (patch)
tree33963225cd9bc45e911e5230a33bdc45be6e8927 /tools
parentb6070e9a069219e4049fcf017d6a160b80bf37b7 (diff)
downloadQt-6f55976270b22142da78b80abbebf018539587de.zip
Qt-6f55976270b22142da78b80abbebf018539587de.tar.gz
Qt-6f55976270b22142da78b80abbebf018539587de.tar.bz2
QMenu: make the menu follow its parent/caused layout direction
The autotest are included Task-number: QTBUG-5884 Reviewed-by: ogoffart
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index 80c7b53..e25290a 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -867,7 +867,15 @@ void QDesignerMenuBar::showMenu(int index)
if ((menu->windowFlags() & Qt::Popup) != Qt::Popup)
menu->setWindowFlags(Qt::Popup);
menu->adjustSize();
- menu->move(mapToGlobal(g.bottomLeft()));
+ if (layoutDirection() == Qt::LeftToRight) {
+ menu->move(mapToGlobal(g.bottomLeft()));
+ } else {
+ // The position is not initially correct due to the unknown width,
+ // causing it to overlap a bit the first time it is invoked.
+ const QSize menuSize = menu->size();
+ QPoint point = g.bottomRight() - QPoint(menu->width(), 0);
+ menu->move(mapToGlobal(point));
+ }
menu->setFocus(Qt::MouseFocusReason);
menu->raise();
menu->show();