summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qabstractbutton.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-27 00:09:00 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-27 00:09:00 (GMT)
commit1efae63bf7cba55526c91dcff3139d0a10885efc (patch)
treed07e1a5db7b2726bbc5d941da3ed97097820b8ca /src/gui/widgets/qabstractbutton.cpp
parent249bb31dc9fa12acff44ebf0effbdaedc43b5305 (diff)
parent41f1276392444b9e46b30f3537a8a63af6fffc9d (diff)
downloadQt-1efae63bf7cba55526c91dcff3139d0a10885efc.zip
Qt-1efae63bf7cba55526c91dcff3139d0a10885efc.tar.gz
Qt-1efae63bf7cba55526c91dcff3139d0a10885efc.tar.bz2
Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into kinetic-declarativeui
Diffstat (limited to 'src/gui/widgets/qabstractbutton.cpp')
-rw-r--r--src/gui/widgets/qabstractbutton.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp
index cb46791..8834373 100644
--- a/src/gui/widgets/qabstractbutton.cpp
+++ b/src/gui/widgets/qabstractbutton.cpp
@@ -165,7 +165,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
shortcutId(0),
#endif
checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
- down(false), blockRefresh(false),
+ down(false), blockRefresh(false), pressed(false),
#ifndef QT_NO_BUTTONGROUP
group(0),
#endif
@@ -1090,6 +1090,7 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
}
if (hitButton(e->pos())) {
setDown(true);
+ d->pressed = true;
repaint(); //flush paint event before invoking potentially expensive operation
QApplication::flush();
d->emitPressed();
@@ -1103,6 +1104,8 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
{
Q_D(QAbstractButton);
+ d->pressed = false;
+
if (e->button() != Qt::LeftButton) {
e->ignore();
return;
@@ -1127,7 +1130,7 @@ void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QAbstractButton);
- if (!(e->buttons() & Qt::LeftButton)) {
+ if (!(e->buttons() & Qt::LeftButton) || !d->pressed) {
e->ignore();
return;
}