From c3f3f8535418dca6b9aecddd2ada4d9fc9629251 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Fri, 30 Jun 2023 16:10:51 +0300 Subject: [PATCH] QmlDesigner: Prevent showing background contents for widget comboboxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A rectangle filled with the same brush as the parent widget makes a blank cover just behind the combobox to prevent showing the contents of the behind widget. Task-number: QDS-6298 Change-Id: I4b2014a60282e109086351d3bd4694ae7c519e8d Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Henning Gründl --- src/plugins/qmldesignerbase/studio/studiostyle.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesignerbase/studio/studiostyle.cpp b/src/plugins/qmldesignerbase/studio/studiostyle.cpp index ffe652e363e..74dd5bfe495 100644 --- a/src/plugins/qmldesignerbase/studio/studiostyle.cpp +++ b/src/plugins/qmldesignerbase/studio/studiostyle.cpp @@ -591,8 +591,7 @@ void StudioStyle::drawComplexControl( const QWidget *widget) const { switch (control) { - - case CC_Slider: + case CC_Slider: { if (const auto *slider = qstyleoption_cast(option)) { QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); @@ -757,8 +756,14 @@ void StudioStyle::drawComplexControl( } painter->restore(); } - break; - + } break; + case CC_ComboBox: { + if (QWidget *parentWidget = widget->parentWidget()) { + QBrush bgColor = parentWidget->palette().brush(parentWidget->backgroundRole()); + painter->fillRect(option->rect, bgColor); + } + Super::drawComplexControl(control, option, painter, widget); + } break; default: Super::drawComplexControl(control, option, painter, widget); break;