From fd8e6a203ecfeebc03772b3bce14c91a6fc0a8e1 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 26 Oct 2020 17:15:56 +0100 Subject: [PATCH] QPushButton: if mouse tracking is off, ignore state only updated when tracking Amends 3310e13a17d2249a86fa533e350744c5593be54f. The explicit hovering state is only updated when handling MouseMove events, and those are only delivered when mouseTracking is set. Without mouseTracking set, the state was always false, and QPushButton didn't set the MouseOver style flag. Ignore the new state if mouse tracking is not set. Task-number: QTBUG-87706 Change-Id: I2718fb23c206fd8dfd427edc987ff193ba1be8a0 Reviewed-by: Doris Verria Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qpushbutton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 3645b5e03d7..65c09660925 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -330,7 +330,7 @@ void QPushButton::initStyleOption(QStyleOptionButton *option) const option->state |= QStyle::State_On; if (!d->flat && !d->down) option->state |= QStyle::State_Raised; - if (underMouse()) + if (underMouse() && hasMouseTracking()) option->state.setFlag(QStyle::State_MouseOver, d->hovering); option->text = d->text; option->icon = d->icon;