Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qmenubar.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    103103    QStyleOptionToolButton opt;
    104104    initStyleOption(&opt);
    105     // We do not need to draw both extention arrows
     105    // We do not need to draw both extension arrows
    106106    opt.features &= ~QStyleOptionToolButton::HasMenu;
    107107    p.drawComplexControl(QStyle::CC_ToolButton, opt);
     
    269269QRect QMenuBarPrivate::actionRect(QAction *act) const
    270270{
    271     Q_Q(const QMenuBar);
    272271    const int index = actions.indexOf(act);
    273     if (index == -1)
    274         return QRect();
    275272
    276273    //makes sure the geometries are up-to-date
    277274    const_cast<QMenuBarPrivate*>(this)->updateGeometries();
    278275
    279     if (index >= actionRects.count())
     276    if (index < 0 || index >= actionRects.count())
    280277        return QRect(); // that can happen in case of native menubar
    281278
    282     QRect ret = actionRects.at(index);
    283     return QStyle::visualRect(q->layoutDirection(), q->rect(), ret);
     279    return actionRects.at(index);
    284280}
    285281
     
    506502        //keep moving along..
    507503        x += rect.width() + itemSpacing;
     504
     505        //make sure we follow the layout direction
     506        rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect);
    508507    }
    509508}
     
    770769    const int end =  increment == -1 ? 0 : actions.count() - 1;
    771770
    772     for (int i = start; start != end;) {
     771    for (int i = start; i != end;) {
    773772        i += increment;
    774773        QAction *current = actions.at(i);
     
    16301629
    16311630/*!
    1632   \internal
    1633 
    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
     1632the location has a separator.
     1633
     1634    \sa addAction(), addSeparator()
    16361635*/
    16371636QAction *QMenuBar::actionAt(const QPoint &pt) const
     
    16421641
    16431642/*!
    1644   \internal
    1645 
    1646   Returns the geometry of action \a act.
     1643  Returns the geometry of action \a act as a QRect.
     1644
     1645    \sa actionAt()
    16471646*/
    16481647QRect QMenuBar::actionGeometry(QAction *act) const
     
    18381837
    18391838/*!
    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.
    18441850*/
    18451851void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner)
     
    18711877
    18721878/*!
    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.
    18771884*/
    18781885QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
     
    19331940        }
    19341941        macUpdateMenuBar();
    1935         updateGeometry();
    1936         setVisible(false);
    1937         setVisible(true);
     1942        updateGeometry();
     1943        if (!d->nativeMenuBar && parentWidget())
     1944            setVisible(true);
    19381945#endif
    19391946    }
Note: See TracChangeset for help on using the changeset viewer.