Prevent state change of selected LineEdit in QWindowsVistaStyle when hovering

Hovering over a selected LineEdit gives the selected state precedence
over hover state.

Fixes: QTBUG-117606
Pick-to: 6.5 6.6
Change-Id: Ia52ce94443100bf3fb5d83b8dffa2752818ca33d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
This commit is contained in:
Wladimir Leuschner 2023-09-28 13:34:28 +02:00
parent 9a64449cc3
commit 4f51742ee1

View File

@ -1442,17 +1442,17 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
theme = OpenThemeData(nullptr, L"Edit");
partId = EP_EDITBORDER_NOSCROLL;
if (oldState & State_MouseOver)
if (oldState & State_HasFocus)
fromState = ETS_SELECTED;
else if (oldState & State_MouseOver)
fromState = ETS_HOT;
else if (oldState & State_HasFocus)
fromState = ETS_FOCUSED;
else
fromState = ETS_NORMAL;
if (state & State_MouseOver)
if (state & State_HasFocus)
toState = ETS_SELECTED;
else if (state & State_MouseOver)
toState = ETS_HOT;
else if (state & State_HasFocus)
toState = ETS_FOCUSED;
else
toState = ETS_NORMAL;
@ -1957,10 +1957,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
stateId = ETS_DISABLED;
else if (state & State_ReadOnly)
stateId = ETS_READONLY;
else if (state & State_MouseOver)
stateId = ETS_HOT;
else if (state & State_HasFocus)
stateId = ETS_SELECTED;
else if (state & State_MouseOver)
stateId = ETS_HOT;
QWindowsThemeData theme(widget, painter,
QWindowsVistaStylePrivate::EditTheme,
EP_EDITBORDER_NOSCROLL, stateId, option->rect);