forked from qt-creator/qt-creator
QmlDesigner: Modify the background color for the ComboBoxes on ToolBar
Task-number: QDS-10706 Change-Id: Id67479d771ee0f8ac6b6116703ad2821517374cd Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -37,6 +37,7 @@ constexpr char C_PANEL_WIDGET[] = "panelwidget";
|
||||
constexpr char C_PANEL_WIDGET_SINGLE_ROW[] = "panelwidget_singlerow";
|
||||
constexpr char C_SHOW_BORDER[] = "showborder";
|
||||
constexpr char C_TOP_BORDER[] = "topBorder";
|
||||
constexpr char C_TOOLBAR_ACTIONWIDGET[] = "toolbar_actionWidget";
|
||||
|
||||
enum ToolbarStyle {
|
||||
ToolbarStyleCompact,
|
||||
|
@@ -728,8 +728,17 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element,
|
||||
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
|
||||
}
|
||||
} else if (option->state & State_Enabled && option->state & State_MouseOver) {
|
||||
StyleHelper::drawPanelBgRect(
|
||||
painter, rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor));
|
||||
if (widget->property(StyleHelper::C_TOOLBAR_ACTIONWIDGET).toBool()) {
|
||||
painter->save();
|
||||
painter->setBrush(creatorTheme()->color(Theme::FancyToolButtonHoverColor));
|
||||
painter->drawRoundedRect(rect, 5, 5);
|
||||
painter->restore();
|
||||
} else {
|
||||
StyleHelper::drawPanelBgRect(painter,
|
||||
rect,
|
||||
creatorTheme()->color(
|
||||
Theme::FancyToolButtonHoverColor));
|
||||
}
|
||||
}
|
||||
if (option->state & State_HasFocus && (option->state & State_KeyboardFocusChange)) {
|
||||
QColor highlight = option->palette.highlight().color();
|
||||
|
@@ -126,6 +126,7 @@ QWidget *ZoomAction::createWidget(QWidget *parent)
|
||||
if (!m_combo && parentIsToolBar(parent)) {
|
||||
m_combo = createZoomComboBox(parent);
|
||||
m_combo->setProperty(Utils::StyleHelper::C_HIDE_BORDER, true);
|
||||
m_combo->setProperty(Utils::StyleHelper::C_TOOLBAR_ACTIONWIDGET, true);
|
||||
m_combo->setCurrentIndex(m_index);
|
||||
m_combo->setToolTip(m_combo->currentText());
|
||||
|
||||
|
@@ -65,6 +65,7 @@ QWidget *BackgroundAction::createWidget(QWidget *parent)
|
||||
this, &BackgroundAction::emitBackgroundChanged);
|
||||
|
||||
comboBox->setProperty(Utils::StyleHelper::C_HIDE_BORDER, true);
|
||||
comboBox->setProperty(Utils::StyleHelper::C_TOOLBAR_ACTIONWIDGET, true);
|
||||
comboBox->setToolTip(tr("Set the color of the canvas."));
|
||||
m_comboBox = comboBox;
|
||||
return comboBox;
|
||||
|
@@ -594,10 +594,7 @@ void StudioStyle::drawComplexControl(
|
||||
}
|
||||
} break;
|
||||
case CC_ComboBox: {
|
||||
if (QWidget *parentWidget = widget->parentWidget()) {
|
||||
QBrush bgColor = parentWidget->palette().brush(parentWidget->backgroundRole());
|
||||
painter->fillRect(option->rect, bgColor);
|
||||
}
|
||||
painter->fillRect(option->rect, standardPalette().brush(QPalette::ColorRole::Base));
|
||||
Super::drawComplexControl(control, option, painter, widget);
|
||||
} break;
|
||||
|
||||
|
Reference in New Issue
Block a user