path: root/src/widgets
diff options
authorRichard Moe Gustavsen <>2017-10-25 13:24:49 +0200
committerRichard Moe Gustavsen <>2017-11-15 10:06:16 +0000
commit7465329fe18315d50c4e6325cfd7c9fc1e203812 (patch)
treeaae82f64d6666a616bc5e7234216a6fe547c1687 /src/widgets
parent3dab19ffed61a69166045d6e90e1e114d81f85a8 (diff)
QAbstractButton: don't clear 'pressed' flag unless left button is released
As it stood, we would set 'pressed' to false regardless of which button that was released. This would end up wrong if pressing the left button, and at the same time, did a click with the right button. This would clear the flag prematurely, and cause a release signal not to be emitted when later releasing the left button. tst_QAbstractButton: adding autotest Adding tests to simulate the bug report's cases: 1) left press button 2) click right/middle key 3) move mouse out of button's boundary 4) test if the released() signal triggered properly Taks-number: QTBUG-53244 Change-Id: Ifc0d5f52a917ac9cd2df5e86c0475abcda47e425 Reviewed-by: Richard Moe Gustavsen <>
Diffstat (limited to 'src/widgets')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index dbd94e890d..5854472ff0 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -991,13 +991,14 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
- d->pressed = false;
if (e->button() != Qt::LeftButton) {
+ d->pressed = false;
if (!d->down) {
// refresh is required by QMacStyle to resume the default button animation