diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-03-18 12:50:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-20 11:24:16 +0100 |
commit | 020d873a5753c4c147d11ac98682d270554e1d05 (patch) | |
tree | 40a770a6b67abb9906b0b31ac07202e2c763cc62 | |
parent | 7fb4fefc037deac4864beb6b17476191c0b13f36 (diff) | |
download | qt4-tools-020d873a5753c4c147d11ac98682d270554e1d05.tar.gz |
QMenuPrivate: Make sloppyDelayTimer non-static
Keeping the timer static would trigger warnings when enabling
SH_Menu_SloppySubMenus in QCommonStyle in a forthcoming patch.
This would happen if we opened a second level submenu quickly
enough and get the mouse event handler to reset the timer its
parent menu started.
This is a backport of Ia768603b40b219f87138c60a595c65ef408761ae
from qt/qtbase.
Change-Id: Ia7e9a94b3445d9362a60a36d5e4dda878ab0f7a5
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_p.h | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index db3d7cd6c7..2a7477adbc 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -90,7 +90,6 @@ QT_BEGIN_NAMESPACE QMenu *QMenuPrivate::mouseDown = 0; -int QMenuPrivate::sloppyDelayTimer = 0; /* QMenu code */ // internal class used for the torn off popup @@ -2874,7 +2873,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) } if (d->sloppyRegion.contains(e->pos())) { d->sloppyAction = action; - QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); + d->sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); } else if (action != d->currentAction) { d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)); } @@ -2915,9 +2914,9 @@ QMenu::timerEvent(QTimerEvent *e) } else if(d->menuDelayTimer.timerId() == e->timerId()) { d->menuDelayTimer.stop(); internalDelayedPopup(); - } else if(QMenuPrivate::sloppyDelayTimer == e->timerId()) { - killTimer(QMenuPrivate::sloppyDelayTimer); - QMenuPrivate::sloppyDelayTimer = 0; + } else if (d->sloppyDelayTimer == e->timerId()) { + killTimer(d->sloppyDelayTimer); + d->sloppyDelayTimer = 0; internalSetSloppyAction(); } else if(d->searchBufferTimer.timerId() == e->timerId()) { d->searchBuffer.clear(); diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 71679a0296..3c93d0b7ee 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -153,7 +153,7 @@ public: cancelAction(0), #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), - hasCheckableItems(0), sloppyAction(0), doChildEffects(false) + hasCheckableItems(0), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false) #ifdef QT3_SUPPORT ,emitHighlighted(false) #endif @@ -275,7 +275,7 @@ public: mutable bool hasCheckableItems; //sloppy selection - static int sloppyDelayTimer; + int sloppyDelayTimer; mutable QAction *sloppyAction; QRegion sloppyRegion; |