forked from qt-creator/qt-creator
QmlDesigner: Prevent showing background contents for widget comboboxes
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 <ci_patchbuild_bot@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -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<const QStyleOptionSlider *>(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;
|
||||
|
Reference in New Issue
Block a user