equal
deleted
inserted
replaced
266 #endif |
266 #endif |
267 } |
267 } |
268 |
268 |
269 QRect QMenuBarPrivate::actionRect(QAction *act) const |
269 QRect QMenuBarPrivate::actionRect(QAction *act) const |
270 { |
270 { |
271 Q_Q(const QMenuBar); |
|
272 const int index = actions.indexOf(act); |
271 const int index = actions.indexOf(act); |
273 if (index == -1) |
|
274 return QRect(); |
|
275 |
272 |
276 //makes sure the geometries are up-to-date |
273 //makes sure the geometries are up-to-date |
277 const_cast<QMenuBarPrivate*>(this)->updateGeometries(); |
274 const_cast<QMenuBarPrivate*>(this)->updateGeometries(); |
278 |
275 |
279 if (index >= actionRects.count()) |
276 if (index < 0 || index >= actionRects.count()) |
280 return QRect(); // that can happen in case of native menubar |
277 return QRect(); // that can happen in case of native menubar |
281 |
278 |
282 QRect ret = actionRects.at(index); |
279 return actionRects.at(index); |
283 return QStyle::visualRect(q->layoutDirection(), q->rect(), ret); |
|
284 } |
280 } |
285 |
281 |
286 void QMenuBarPrivate::focusFirstAction() |
282 void QMenuBarPrivate::focusFirstAction() |
287 { |
283 { |
288 if(!currentAction) { |
284 if(!currentAction) { |
503 } |
499 } |
504 rect.moveTop(y); |
500 rect.moveTop(y); |
505 |
501 |
506 //keep moving along.. |
502 //keep moving along.. |
507 x += rect.width() + itemSpacing; |
503 x += rect.width() + itemSpacing; |
|
504 |
|
505 //make sure we follow the layout direction |
|
506 rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect); |
508 } |
507 } |
509 } |
508 } |
510 |
509 |
511 void QMenuBarPrivate::activateAction(QAction *action, QAction::ActionEvent action_e) |
510 void QMenuBarPrivate::activateAction(QAction *action, QAction::ActionEvent action_e) |
512 { |
511 { |
1930 } |
1929 } |
1931 } else { |
1930 } else { |
1932 d->macCreateMenuBar(parentWidget()); |
1931 d->macCreateMenuBar(parentWidget()); |
1933 } |
1932 } |
1934 macUpdateMenuBar(); |
1933 macUpdateMenuBar(); |
1935 updateGeometry(); |
1934 updateGeometry(); |
1936 setVisible(false); |
1935 if (!d->nativeMenuBar && parentWidget()) |
1937 setVisible(true); |
1936 setVisible(true); |
1938 #endif |
1937 #endif |
1939 } |
1938 } |
1940 } |
1939 } |
1941 |
1940 |
1942 bool QMenuBar::isNativeMenuBar() const |
1941 bool QMenuBar::isNativeMenuBar() const |
1955 |
1954 |
1956 The default action is assigned to the left soft key. The menu is assigned |
1955 The default action is assigned to the left soft key. The menu is assigned |
1957 to the right soft key. |
1956 to the right soft key. |
1958 |
1957 |
1959 Currently there is only support for the default action on Windows |
1958 Currently there is only support for the default action on Windows |
1960 Mobile. All other platforms ignore the default action. |
1959 Mobile. On all other platforms this method is not available. |
1961 |
1960 |
1962 \sa defaultAction() |
1961 \sa defaultAction() |
1963 */ |
1962 */ |
1964 |
1963 |
1965 #ifdef Q_WS_WINCE |
1964 #ifdef Q_WS_WINCE |