src/gui/widgets/qmenubar.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
--- a/src/gui/widgets/qmenubar.cpp	Mon Jun 21 22:38:13 2010 +0100
+++ b/src/gui/widgets/qmenubar.cpp	Thu Jul 22 16:41:55 2010 +0100
@@ -268,19 +268,15 @@
 
 QRect QMenuBarPrivate::actionRect(QAction *act) const
 {
-    Q_Q(const QMenuBar);
     const int index = actions.indexOf(act);
-    if (index == -1)
-        return QRect();
 
     //makes sure the geometries are up-to-date
     const_cast<QMenuBarPrivate*>(this)->updateGeometries();
 
-    if (index >= actionRects.count())
+    if (index < 0 || index >= actionRects.count())
         return QRect(); // that can happen in case of native menubar
 
-    QRect ret = actionRects.at(index);
-    return QStyle::visualRect(q->layoutDirection(), q->rect(), ret);
+    return actionRects.at(index);
 }
 
 void QMenuBarPrivate::focusFirstAction()
@@ -505,6 +501,9 @@
 
         //keep moving along..
         x += rect.width() + itemSpacing;
+
+        //make sure we follow the layout direction
+        rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect);
     }
 }
 
@@ -1932,9 +1931,9 @@
             d->macCreateMenuBar(parentWidget());
         }
         macUpdateMenuBar();
-        updateGeometry();
-        setVisible(false);
-        setVisible(true);
+	updateGeometry();
+	if (!d->nativeMenuBar && parentWidget())
+	    setVisible(true);
 #endif
     }
 }
@@ -1957,7 +1956,7 @@
   to the right soft key.
 
   Currently there is only support for the default action on Windows
-  Mobile. All other platforms ignore the default action.
+  Mobile. On all other platforms this method is not available.
 
   \sa defaultAction()
 */