diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 04:45:22 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 04:45:22 (GMT) |
commit | fbacd0fb2eb41470b090a3cbca7535f78689a382 (patch) | |
tree | 4f6ca32958fd9c5c95ae9ca2f599bf56067d2c45 /src/gui/widgets/qmenu.cpp | |
parent | 3e94b3a77affeef80544e48949e018ced4e0d96e (diff) | |
parent | 9f0884773a451a4feef80812e015266bd487dcdc (diff) | |
download | Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.zip Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.gz Qt-fbacd0fb2eb41470b090a3cbca7535f78689a382.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (61 commits)
Revert Merge Request 551. This introduces regressions to Qt.
Fixed scroll area size calculation on Mac.
Fix a race where QThread::exit() is "lost" when called after start()
make a partial build of linguist in no-gui config
make the code less of a trap
fix build from top level
Partially revert MR 543 changes to Linguist.
Apply f176759fc41abc4cb901c2cbaa15264f2a9ac85b to stdout too.
Autotest: add some debugging, just in case there's something wrong
Autotest: fix the fix for the rounding error.
Fix compile error with QT_NO_LIBRARY in QtMultimedia
the _setmode() prototype is different on win ce
qdoc: Changed qdoc to output the new doc format.
Doc: update 'developing on mac'
fcntl.h doesn't seem to exist, either - contrary to an example on msdn
Autotest: fix paths on the test server after update.
Force the repaint during a window resize.
fix compile on wince
remove CONFIG += ordered again
Assistant: Check namespace and virtual folder syntax of help projects.
...
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 9e190b7..f9b132e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1805,7 +1805,7 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); - if (d->scroll) { //reset scroll state from last popup + if (d->scroll) { // reset scroll state from last popup d->scroll->scrollOffset = 0; d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } @@ -1860,9 +1860,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } #endif if (d->ncols > 1) { - pos.setY(screen.top()+desktopFrame); + pos.setY(screen.top() + desktopFrame); } else if (atAction) { - for(int i = 0, above_height = 0; i < d->actions.count(); i++) { + for (int i = 0, above_height = 0; i < d->actions.count(); i++) { QAction *action = d->actions.at(i); if (action == atAction) { int newY = pos.y() - above_height; @@ -1877,7 +1877,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (d->scroll && d->scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, 0, this)) { int below_height = above_height + d->scroll->scrollOffset; - for(int i2 = i; i2 < d->actionRects.count(); i2++) + for (int i2 = i; i2 < d->actionRects.count(); i2++) below_height += d->actionRects.at(i2).height(); size.setHeight(below_height); } @@ -1890,28 +1890,28 @@ void QMenu::popup(const QPoint &p, QAction *atAction) QPoint mouse = QCursor::pos(); d->mousePopupPos = mouse; - const bool snapToMouse = (QRect(p.x()-3, p.y()-3, 6, 6).contains(mouse)); + const bool snapToMouse = (QRect(p.x() - 3, p.y() - 3, 6, 6).contains(mouse)); if (adjustToDesktop) { - //handle popup falling "off screen" + // handle popup falling "off screen" if (isRightToLeft()) { - if(snapToMouse) //position flowing left from the mouse - pos.setX(mouse.x()-size.width()); + if (snapToMouse) // position flowing left from the mouse + pos.setX(mouse.x() - size.width()); #ifndef QT_NO_MENUBAR - //if in a menubar, it should be right-aligned + // if in a menubar, it should be right-aligned if (qobject_cast<QMenuBar*>(d->causedPopup.widget)) pos.rx() -= size.width(); #endif //QT_NO_MENUBAR - if (pos.x() < screen.left()+desktopFrame) - pos.setX(qMax(p.x(), screen.left()+desktopFrame)); - if (pos.x()+size.width()-1 > screen.right()-desktopFrame) - pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1)); + if (pos.x() < screen.left() + desktopFrame) + pos.setX(qMax(p.x(), screen.left() + desktopFrame)); + if (pos.x() + size.width() - 1 > screen.right() - desktopFrame) + pos.setX(qMax(p.x() - size.width(), screen.right() - desktopFrame - size.width() + 1)); } else { - if (pos.x()+size.width()-1 > screen.right()-desktopFrame) - pos.setX(screen.right()-desktopFrame-size.width()+1); - if (pos.x() < screen.left()+desktopFrame) + if (pos.x() + size.width() - 1 > screen.right() - desktopFrame) + pos.setX(screen.right() - desktopFrame - size.width() + 1); + if (pos.x() < screen.left() + desktopFrame) pos.setX(screen.left() + desktopFrame); } if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { @@ -1925,14 +1925,14 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (pos.y() < screen.top() + desktopFrame) pos.setY(screen.top() + desktopFrame); - if (pos.y()+size.height()-1 > screen.bottom() - desktopFrame) { + if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { if (d->scroll) { d->scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown); int y = qMax(screen.y(),pos.y()); - size.setHeight(screen.bottom()-(desktopFrame*2)-y); + size.setHeight(screen.bottom() - (desktopFrame * 2) - y); } else { // Too big for screen, bias to see bottom of menu (for some reason) - pos.setY(screen.bottom()-size.height()+1); + pos.setY(screen.bottom() - size.height() + 1); } } } @@ -1941,19 +1941,19 @@ void QMenu::popup(const QPoint &p, QAction *atAction) int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; if (isRightToLeft()) { - if ((snapToMouse && (pos.x() + size.width()/2 > mouse.x())) || - (qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width()/2 > d->causedPopup.widget->x())) + if ((snapToMouse && (pos.x() + size.width() / 2 > mouse.x())) || + (qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width() / 2 > d->causedPopup.widget->x())) hGuess = QEffects::RightScroll; } else { - if ((snapToMouse && (pos.x() + size.width()/2 < mouse.x())) || - (qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width()/2 < d->causedPopup.widget->x())) + if ((snapToMouse && (pos.x() + size.width() / 2 < mouse.x())) || + (qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width() / 2 < d->causedPopup.widget->x())) hGuess = QEffects::LeftScroll; } #ifndef QT_NO_MENUBAR - if ((snapToMouse && (pos.y() + size.height()/2 < mouse.y())) || + if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) || (qobject_cast<QMenuBar*>(d->causedPopup.widget) && - pos.y() + size.width()/2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) + pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) vGuess = QEffects::UpScroll; #endif if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) { |