QPushButton: if mouse tracking is off, ignore state only updated when tracking

Amends 3310e13a17. 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 <doris.verria@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Volker Hilsheimer 2020-10-26 17:15:56 +01:00
parent 6949bfaa92
commit fd8e6a203e
1 changed files with 1 additions and 1 deletions

View File

@ -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;