Prevent recursions when triggering menus in QToolButton

With a global shortcut set it would be possible
to let the button re-open the menu again and again,
each time spinning an event loop.

Task-number: QTBUG-30399
Change-Id: If7eddc115c77fef3df3e751fd72e7414cedaf272
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Frederik Gladhorn 2013-04-16 17:51:33 +02:00 committed by The Qt Project
parent 2ddbba9ba9
commit f5ea183cc6

View File

@ -680,6 +680,10 @@ void QToolButton::showMenu()
d->menuButtonDown = false;
return; // no menu to show
}
// prevent recursions spinning another event loop
if (d->menuButtonDown)
return;
d->menuButtonDown = true;
repaint();