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. Change-Id: Ia768603b40b219f87138c60a595c65ef408761ae Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
c02cc25e83
commit
f5224bd4d1
@ -75,7 +75,6 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QMenu *QMenuPrivate::mouseDown = 0;
|
QMenu *QMenuPrivate::mouseDown = 0;
|
||||||
int QMenuPrivate::sloppyDelayTimer = 0;
|
|
||||||
|
|
||||||
/* QMenu code */
|
/* QMenu code */
|
||||||
// internal class used for the torn off popup
|
// internal class used for the torn off popup
|
||||||
@ -2897,13 +2896,13 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
|
|||||||
}
|
}
|
||||||
if (d->sloppyRegion.contains(e->pos())) {
|
if (d->sloppyRegion.contains(e->pos())) {
|
||||||
// If the timer is already running then don't start a new one unless the action is the same
|
// If the timer is already running then don't start a new one unless the action is the same
|
||||||
if (d->sloppyAction != action && QMenuPrivate::sloppyDelayTimer != 0) {
|
if (d->sloppyAction != action && d->sloppyDelayTimer != 0) {
|
||||||
killTimer(QMenuPrivate::sloppyDelayTimer);
|
killTimer(d->sloppyDelayTimer);
|
||||||
QMenuPrivate::sloppyDelayTimer = 0;
|
d->sloppyDelayTimer = 0;
|
||||||
}
|
}
|
||||||
if (QMenuPrivate::sloppyDelayTimer == 0) {
|
if (d->sloppyDelayTimer == 0) {
|
||||||
d->sloppyAction = action;
|
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) {
|
} else if (action != d->currentAction) {
|
||||||
d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this));
|
d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this));
|
||||||
@ -2945,9 +2944,9 @@ QMenu::timerEvent(QTimerEvent *e)
|
|||||||
} else if(d->menuDelayTimer.timerId() == e->timerId()) {
|
} else if(d->menuDelayTimer.timerId() == e->timerId()) {
|
||||||
d->menuDelayTimer.stop();
|
d->menuDelayTimer.stop();
|
||||||
internalDelayedPopup();
|
internalDelayedPopup();
|
||||||
} else if(QMenuPrivate::sloppyDelayTimer == e->timerId()) {
|
} else if (d->sloppyDelayTimer == e->timerId()) {
|
||||||
killTimer(QMenuPrivate::sloppyDelayTimer);
|
killTimer(d->sloppyDelayTimer);
|
||||||
QMenuPrivate::sloppyDelayTimer = 0;
|
d->sloppyDelayTimer = 0;
|
||||||
internalSetSloppyAction();
|
internalSetSloppyAction();
|
||||||
} else if(d->searchBufferTimer.timerId() == e->timerId()) {
|
} else if(d->searchBufferTimer.timerId() == e->timerId()) {
|
||||||
d->searchBuffer.clear();
|
d->searchBuffer.clear();
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
cancelAction(0),
|
cancelAction(0),
|
||||||
#endif
|
#endif
|
||||||
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
|
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
|
||||||
hasCheckableItems(0), sloppyAction(0), doChildEffects(false), platformMenu(0)
|
hasCheckableItems(0), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false), platformMenu(0)
|
||||||
|
|
||||||
#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
|
#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
|
||||||
,wce_menu(0)
|
,wce_menu(0)
|
||||||
@ -204,7 +204,7 @@ public:
|
|||||||
mutable bool hasCheckableItems;
|
mutable bool hasCheckableItems;
|
||||||
|
|
||||||
//sloppy selection
|
//sloppy selection
|
||||||
static int sloppyDelayTimer;
|
int sloppyDelayTimer;
|
||||||
mutable QAction *sloppyAction;
|
mutable QAction *sloppyAction;
|
||||||
QRegion sloppyRegion;
|
QRegion sloppyRegion;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user