Changeset 846 for trunk/src/gui/widgets/qmenubar.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qmenubar.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 103 103 QStyleOptionToolButton opt; 104 104 initStyleOption(&opt); 105 // We do not need to draw both exten tion arrows105 // We do not need to draw both extension arrows 106 106 opt.features &= ~QStyleOptionToolButton::HasMenu; 107 107 p.drawComplexControl(QStyle::CC_ToolButton, opt); … … 269 269 QRect QMenuBarPrivate::actionRect(QAction *act) const 270 270 { 271 Q_Q(const QMenuBar);272 271 const int index = actions.indexOf(act); 273 if (index == -1)274 return QRect();275 272 276 273 //makes sure the geometries are up-to-date 277 274 const_cast<QMenuBarPrivate*>(this)->updateGeometries(); 278 275 279 if (index >= actionRects.count())276 if (index < 0 || index >= actionRects.count()) 280 277 return QRect(); // that can happen in case of native menubar 281 278 282 QRect ret = actionRects.at(index); 283 return QStyle::visualRect(q->layoutDirection(), q->rect(), ret); 279 return actionRects.at(index); 284 280 } 285 281 … … 506 502 //keep moving along.. 507 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 } … … 770 769 const int end = increment == -1 ? 0 : actions.count() - 1; 771 770 772 for (int i = start; start!= end;) {771 for (int i = start; i != end;) { 773 772 i += increment; 774 773 QAction *current = actions.at(i); … … 1630 1629 1631 1630 /*! 1632 \internal1633 1634 Return the item at \a pt, or 0 if there is no item there or if it is 1635 a separator item.1631 Returns the QAction at \a pt. Returns 0 if there is no action at \a pt or if 1632 the location has a separator. 1633 1634 \sa addAction(), addSeparator() 1636 1635 */ 1637 1636 QAction *QMenuBar::actionAt(const QPoint &pt) const … … 1642 1641 1643 1642 /*! 1644 \internal1645 1646 Returns the geometry of action \a act.1643 Returns the geometry of action \a act as a QRect. 1644 1645 \sa actionAt() 1647 1646 */ 1648 1647 QRect QMenuBar::actionGeometry(QAction *act) const … … 1838 1837 1839 1838 /*! 1840 \internal 1841 1842 This sets widget \a w to be shown directly on the left of the first or 1843 the right of the last menu item, depending on \a corner. 1839 \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner) 1840 1841 This sets the given \a widget to be shown directly on the left of the first 1842 menu item, or on the right of the last menu item, depending on \a corner. 1843 1844 The menu bar takes ownership of \a widget, reparenting it into the menu bar. 1845 However, if the \a corner already contains a widget, this previous widget 1846 will no longer be managed and will still be a visible child of the menu bar. 1847 1848 \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner 1849 will result in a warning. 1844 1850 */ 1845 1851 void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) … … 1871 1877 1872 1878 /*! 1873 \internal 1874 1875 Returns the widget in the left of the first or the right of the last menu 1876 item, depending on \a corner. 1879 Returns the widget on the left of the first or on the right of the last menu 1880 item, depending on \a corner. 1881 1882 \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner 1883 will result in a warning. 1877 1884 */ 1878 1885 QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const … … 1933 1940 } 1934 1941 macUpdateMenuBar(); 1935 1936 setVisible(false); 1937 1942 updateGeometry(); 1943 if (!d->nativeMenuBar && parentWidget()) 1944 setVisible(true); 1938 1945 #endif 1939 1946 }
Note:
See TracChangeset
for help on using the changeset viewer.