diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-08-10 14:58:39 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-08-13 18:12:33 +0200 |
commit | 53cdb31f293fdbe9667ce944f22343634f1866b1 (patch) | |
tree | 4e79bea442d976fad2bd86af50d2064d837ed9b2 /src/widgets/styles | |
parent | 5a01505df5f5444d308b8e662fc45f1a942507e1 (diff) | |
download | qtbase-53cdb31f293fdbe9667ce944f22343634f1866b1.tar.gz |
StyleSheet: Use rule for ComboBox in embedded QLineEdit
An editable combobox uses an embedded QLineEdit as an implementation
detail. That lineedit should use the rules that are set for the combobox
to render itself, similar to what was already implemented for the lineedit
used in a QAbstractSpinBox.
The containerWidget helper function provides the logic for identifying
the container of the rendered widget, returning the QAbstractSpinBox or
the QComboBox for an embedded QLineEdit. Use that method rather than
duplicating the logic.
Fixes: QTBUG-95631
Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit adafa5ee1f37739f33f6417f27c8ee7308aaad9c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ae33dca1c6..495fc29969 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4449,14 +4449,14 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_PanelLineEdit: if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { -#if QT_CONFIG(spinbox) - if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) { - QRenderRule spinboxRule = renderRule(w->parentWidget(), opt); - if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw()) + QWidget *container = containerWidget(w); + if (container != w) { + QRenderRule containerRule = renderRule(container, opt); + if (!containerRule.hasNativeBorder() || !containerRule.baseStyleCanDraw()) return; - rule = spinboxRule; + rule = containerRule; } -#endif + if (rule.hasNativeBorder()) { QStyleOptionFrame frmOpt(*frm); rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base); |