From c5a9996213a535ad6b1e183ed258913082213073 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 9 Jun 2009 11:10:46 +0200 Subject: Fix focus frame on combobox on non-Windows styles State_KeyboardFocusChange only makes sens on Windows. Follow the logic on the combobox as in PE_FrameFocusRect in the QWindowsStyle Task-number: 255482 Reviewed-by: jbache --- src/gui/styles/qcleanlooksstyle.cpp | 3 ++- src/gui/styles/qgtkstyle.cpp | 2 +- src/gui/styles/qplastiquestyle.cpp | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index b33dfc1..805cd05 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -3305,7 +3305,8 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp } } // Draw the focus rect - if ((focus && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) { + if (focus && !comboBox->editable + && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) { QStyleOptionFocusRect focus; focus.rect = subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget) .adjusted(0, 2, option->direction == Qt::RightToLeft ? 1 : -1, -2); diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 1fe4627..ab81d97 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1426,7 +1426,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QGtk::gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0; int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0; - if ((focus && (option->state & State_KeyboardFocusChange))) + if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) gtkCachedPainter.paintFocus(gtkToggleButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 01c0e44..0a56213 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -4568,7 +4568,8 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt } // Draw the focus rect - if (((option->state & State_HasFocus) && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) { + if ((option->state & State_HasFocus) && !comboBox->editable + && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) { QStyleOptionFocusRect focus; focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget) .adjusted(-2, 0, 2, 0); -- cgit v0.12