summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2010-02-18 15:07:27 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2010-03-03 14:50:16 (GMT)
commitf3dab146f231398455e52ff99d4c6f8365c8d412 (patch)
tree26d35734786498054ca649bb3f9340320b20fa09
parentd4bae0d0e96138d913bfc7ec9fa86b887043787f (diff)
downloadQt-f3dab146f231398455e52ff99d4c6f8365c8d412.zip
Qt-f3dab146f231398455e52ff99d4c6f8365c8d412.tar.gz
Qt-f3dab146f231398455e52ff99d4c6f8365c8d412.tar.bz2
Do not reset state too early on RMB click
When long-tapping on a spin box, a context menu event would stop incrementing the spin box since we called reset() too early. Call reset only if it's clear that there's a context menu. Also don't crash if menu is 0. Reviewed-by: Robert Griebl
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index 4a6235c..7e2f20d 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -1248,8 +1248,11 @@ void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event)
#else
Q_D(QAbstractSpinBox);
- d->reset();
QPointer<QMenu> menu = d->edit->createStandardContextMenu();
+ if (!menu)
+ return;
+
+ d->reset();
QAction *selAll = new QAction(tr("&Select All"), menu);
menu->insertAction(d->edit->d_func()->selectAllAction,