diff --git a/src/libs/tracing/timelinenotesrenderpass.cpp b/src/libs/tracing/timelinenotesrenderpass.cpp index 5a3939b4f32..c0cfa368b5c 100644 --- a/src/libs/tracing/timelinenotesrenderpass.cpp +++ b/src/libs/tracing/timelinenotesrenderpass.cpp @@ -217,7 +217,7 @@ NotesMaterialShader::NotesMaterialShader() static QColor notesColor() { return Utils::creatorTheme() - ? Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor) + ? Utils::creatorColor(Utils::Theme::Timeline_HighlightColor) : QColor(255, 165, 0); } diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index 779b1c9e559..d434350460f 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -111,9 +111,9 @@ void CrumblePathButton::paintEvent(QPaintEvent*) p.drawPixmap(width() - overlapSize, segmentRect.top(), middleSegmentPixmap); if (option.state & QStyle::State_Enabled) - option.palette.setColor(QPalette::ButtonText, creatorTheme()->color(Theme::PanelTextColorLight)); + option.palette.setColor(QPalette::ButtonText, creatorColor(Theme::PanelTextColorLight)); else - option.palette.setColor(QPalette::Disabled, QPalette::ButtonText, creatorTheme()->color(Theme::IconsDisabledColor)); + option.palette.setColor(QPalette::Disabled, QPalette::ButtonText, creatorColor(Theme::IconsDisabledColor)); QStylePainter sp(this); if (option.state & QStyle::State_Sunken) diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp index 88c0ca273ea..c6e1b6da3f1 100644 --- a/src/libs/utils/detailsbutton.cpp +++ b/src/libs/utils/detailsbutton.cpp @@ -87,8 +87,8 @@ QColor DetailsButton::outlineColor() { return HostOsInfo::isMacHost() ? QGuiApplication::palette().color(QPalette::Mid) - : StyleHelper::mergedColors(creatorTheme()->color(Theme::TextColorNormal), - creatorTheme()->color(Theme::BackgroundColorNormal), 15); + : StyleHelper::mergedColors(creatorColor(Theme::TextColorNormal), + creatorColor(Theme::BackgroundColorNormal), 15); } void DetailsButton::paintEvent(QPaintEvent *e) diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp index ec7a3d22ebb..d278a609ff8 100644 --- a/src/libs/utils/detailswidget.cpp +++ b/src/libs/utils/detailswidget.cpp @@ -224,7 +224,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent) QPainter p(this); if (creatorTheme()->flag(Theme::FlatProjectsMode) || HostOsInfo::isMacHost()) { const QColor bgColor = creatorTheme()->flag(Theme::FlatProjectsMode) ? - creatorTheme()->color(Theme::DetailsWidgetBackgroundColor) + creatorColor(Theme::DetailsWidgetBackgroundColor) : palette().color(QPalette::Window); p.fillRect(rect(), bgColor); } diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index d57505a70b7..69d7209c3a5 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -136,8 +136,8 @@ FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) : QObject(parent) , m_lineEdit(parent) , m_completionShortcut(completionShortcut()->key(), parent) - , m_okTextColor(creatorTheme()->color(Theme::TextColorNormal)) - , m_errorTextColor(creatorTheme()->color(Theme::TextColorError)) + , m_okTextColor(creatorColor(Theme::TextColorNormal)) + , m_errorTextColor(creatorColor(Theme::TextColorError)) , m_placeholderTextColor(QApplication::palette().color(QPalette::PlaceholderText)) , m_spinner(new SpinnerSolution::Spinner(SpinnerSolution::SpinnerSize::Small, m_lineEdit)) { diff --git a/src/libs/utils/icon.cpp b/src/libs/utils/icon.cpp index 5bd862c8f14..132494e8252 100644 --- a/src/libs/utils/icon.cpp +++ b/src/libs/utils/icon.cpp @@ -42,7 +42,7 @@ static MasksAndColors masksAndColors(const QList &icon, int dp MasksAndColors result; for (const IconMaskAndColor &i: icon) { const QString &fileName = i.first.toString(); - const QColor color = creatorTheme()->color(i.second); + const QColor color = creatorColor(i.second); const QString dprFileName = StyleHelper::availableImageResolutions(i.first.toString()) .contains(dpr) ? StyleHelper::imageFileWithResolution(fileName, dpr) @@ -165,7 +165,7 @@ QIcon Icon::icon() const const QPixmap combinedMask = Utils::combinedMask(masks, m_style); m_lastIcon.addPixmap(masksToIcon(masks, combinedMask, m_style)); - const QColor disabledColor = creatorTheme()->color(Theme::IconsDisabledColor); + const QColor disabledColor = creatorColor(Theme::IconsDisabledColor); m_lastIcon.addPixmap(maskToColorAndAlpha(combinedMask, disabledColor), QIcon::Disabled); } return m_lastIcon; @@ -182,7 +182,7 @@ QPixmap Icon::pixmap(QIcon::Mode iconMode) const masksAndColors(m_iconSourceList, qRound(qApp->devicePixelRatio())); const QPixmap combinedMask = Utils::combinedMask(masks, m_style); return iconMode == QIcon::Disabled - ? maskToColorAndAlpha(combinedMask, creatorTheme()->color(Theme::IconsDisabledColor)) + ? maskToColorAndAlpha(combinedMask, creatorColor(Theme::IconsDisabledColor)) : masksToIcon(masks, combinedMask, m_style); } } diff --git a/src/libs/utils/iconbutton.cpp b/src/libs/utils/iconbutton.cpp index 746cf0ecb1c..3be368c43b2 100644 --- a/src/libs/utils/iconbutton.cpp +++ b/src/libs/utils/iconbutton.cpp @@ -26,7 +26,7 @@ void IconButton::paintEvent(QPaintEvent *e) QRect r(QPoint(), size()); if (m_containsMouse && isEnabled()) { - QColor c = creatorTheme()->color(Theme::TextColorDisabled); + QColor c = creatorColor(Theme::TextColorDisabled); c.setAlphaF(c.alphaF() * .5); StyleHelper::drawPanelBgRect(&p, r, c); } diff --git a/src/libs/utils/infobar.cpp b/src/libs/utils/infobar.cpp index bd6429a7622..dc5fb4878d2 100644 --- a/src/libs/utils/infobar.cpp +++ b/src/libs/utils/infobar.cpp @@ -47,10 +47,10 @@ void InfoBarWidget::paintEvent(QPaintEvent *event) { QWidget::paintEvent(event); QPainter p(this); - p.fillRect(rect(), creatorTheme()->color(Theme::InfoBarBackground)); + p.fillRect(rect(), creatorColor(Theme::InfoBarBackground)); const QRectF adjustedRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5); const bool topEdge = m_edge == Qt::TopEdge; - p.setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor)); + p.setPen(creatorColor(Theme::FancyToolBarSeparatorColor)); p.drawLine(QLineF(topEdge ? adjustedRect.bottomLeft() : adjustedRect.topLeft(), topEdge ? adjustedRect.bottomRight() : adjustedRect.topRight())); } diff --git a/src/libs/utils/infolabel.cpp b/src/libs/utils/infolabel.cpp index dbc762d9fee..9eb9f801060 100644 --- a/src/libs/utils/infolabel.cpp +++ b/src/libs/utils/infolabel.cpp @@ -114,7 +114,7 @@ void InfoLabel::paintEvent(QPaintEvent *event) if (m_filled && isEnabled()) { p.save(); p.setOpacity(0.175); - p.fillRect(rect(), creatorTheme()->color(fillColorForType(m_type))); + p.fillRect(rect(), creatorColor(fillColorForType(m_type))); p.restore(); } const QIcon &icon = iconForType(m_type); diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index a318bb1cca6..59c29e7fa5f 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -465,7 +465,7 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format) QTextCharFormat OutputFormatter::linkFormat(const QTextCharFormat &inputFormat, const QString &href) { QTextCharFormat result = inputFormat; - result.setForeground(creatorTheme()->color(Theme::TextColorLink)); + result.setForeground(creatorColor(Theme::TextColorLink)); result.setUnderlineStyle(QTextCharFormat::SingleUnderline); result.setAnchor(true); result.setAnchorHref(href); @@ -500,14 +500,13 @@ void OutputFormatter::initFormats() if (!plainTextEdit()) return; - Theme *theme = creatorTheme(); - d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor)); - d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor)); - d->formats[LogMessageFormat].setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor)); - d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor)); - d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor)); - d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); - d->formats[GeneralMessageFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); + d->formats[NormalMessageFormat].setForeground(creatorColor(Theme::OutputPanes_NormalMessageTextColor)); + d->formats[ErrorMessageFormat].setForeground(creatorColor(Theme::OutputPanes_ErrorMessageTextColor)); + d->formats[LogMessageFormat].setForeground(creatorColor(Theme::OutputPanes_WarningMessageTextColor)); + d->formats[StdOutFormat].setForeground(creatorColor(Theme::OutputPanes_StdOutTextColor)); + d->formats[StdErrFormat].setForeground(creatorColor(Theme::OutputPanes_StdErrTextColor)); + d->formats[DebugFormat].setForeground(creatorColor(Theme::OutputPanes_DebugTextColor)); + d->formats[GeneralMessageFormat].setForeground(creatorColor(Theme::OutputPanes_DebugTextColor)); setBoldFontEnabled(d->boldFontEnabled); } diff --git a/src/libs/utils/passworddialog.cpp b/src/libs/utils/passworddialog.cpp index 9d0bd5c562f..94de5f7f0f7 100644 --- a/src/libs/utils/passworddialog.cpp +++ b/src/libs/utils/passworddialog.cpp @@ -34,7 +34,7 @@ void ShowPasswordButton::paintEvent(QPaintEvent *e) QRect r(QPoint(), size()); if (m_containsMouse && isEnabled()) - StyleHelper::drawPanelBgRect(&p, r, creatorTheme()->color(Theme::FancyToolButtonHoverColor)); + StyleHelper::drawPanelBgRect(&p, r, creatorColor(Theme::FancyToolButtonHoverColor)); QSize s = icon.actualSize(QSize(32, 16)); diff --git a/src/libs/utils/qtcolorbutton.cpp b/src/libs/utils/qtcolorbutton.cpp index 6a8537bd5fa..5be9c9c069b 100644 --- a/src/libs/utils/qtcolorbutton.cpp +++ b/src/libs/utils/qtcolorbutton.cpp @@ -171,7 +171,7 @@ void QtColorButton::paintEvent(QPaintEvent *event) constexpr int size = 11; const qreal horPadding = (width() - size) / 2.0; const qreal verPadding = (height() - size) / 2.0; - const QPen pen(creatorTheme()->color(overlayColor), 2); + const QPen pen(creatorColor(overlayColor), 2); p.save(); p.setOpacity(overlayOpacity); @@ -202,7 +202,7 @@ void QtColorButton::paintEvent(QPaintEvent *event) p.setPen(pen); p.setCompositionMode(QPainter::CompositionMode_Difference); } else { - p.setPen(creatorTheme()->color(overlayColor)); + p.setPen(creatorColor(overlayColor)); p.setOpacity(overlayOpacity); } p.drawRect(rect().adjusted(0, 0, -1, -1)); diff --git a/src/libs/utils/stringutils.cpp b/src/libs/utils/stringutils.cpp index 55a2902acc2..d21c7cb9bc1 100644 --- a/src/libs/utils/stringutils.cpp +++ b/src/libs/utils/stringutils.cpp @@ -637,7 +637,7 @@ void MarkdownHighlighter::highlightBlock(const QString &text) image.fill(QColor(0, 0, 0, 0).rgba()); image.setPixel(0, height - 1, - Utils::creatorTheme()->color(Theme::TextColorDisabled).rgba()); + Utils::creatorColor(Theme::TextColorDisabled).rgba()); h2Brush = QBrush(image); } diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 78e4d57436d..617dac09a8e 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -107,7 +107,7 @@ QColor StyleHelper::notTooBrightHighlightColor() QPalette StyleHelper::sidebarFontPalette(const QPalette &original) { QPalette palette = original; - const QColor textColor = creatorTheme()->color(Theme::ProgressBarTitleColor); + const QColor textColor = creatorColor(Theme::ProgressBarTitleColor); palette.setColor(QPalette::WindowText, textColor); palette.setColor(QPalette::Text, textColor); return palette; @@ -137,7 +137,7 @@ QColor StyleHelper::requestedBaseColor() QColor StyleHelper::toolbarBaseColor(bool lightColored) { if (creatorTheme()->flag(Theme::QDSTheme)) - return creatorTheme()->color(Utils::Theme::DStoolbarBackground); + return creatorColor(Utils::Theme::DStoolbarBackground); else return StyleHelper::baseColor(lightColored); } @@ -194,7 +194,7 @@ void StyleHelper::setBaseColor(const QColor &newcolor) { s_requestedBaseColor = newcolor; - const QColor themeBaseColor = creatorTheme()->color(Theme::PanelStatusBarBackgroundColor); + const QColor themeBaseColor = creatorColor(Theme::PanelStatusBarBackgroundColor); const QColor defaultBaseColor = QColor(DEFAULT_BASE_COLOR); QColor color; @@ -366,11 +366,11 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, }; if (!enabled) { - drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor)); + drawCommonStyleArrow(image.rect(), creatorColor(Theme::IconsDisabledColor)); } else { if (creatorTheme()->flag(Theme::ToolBarIconShadow)) drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor()); - drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor)); + drawCommonStyleArrow(image.rect(), creatorColor(Theme::IconsBaseColor)); } painter.end(); pixmap = QPixmap::fromImage(image); @@ -463,9 +463,9 @@ void StyleHelper::drawMinimalArrow(QStyle::PrimitiveElement element, QPainter *p if (enabled) { if (creatorTheme()->flag(Theme::ToolBarIconShadow)) drawArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor()); - drawArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor)); + drawArrow(image.rect(), creatorColor(Theme::IconsBaseColor)); } else { - drawArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor)); + drawArrow(image.rect(), creatorColor(Theme::IconsDisabledColor)); } painter.end(); pixmap = QPixmap::fromImage(image); diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index 536deafc220..ef20ddddb7c 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -38,6 +38,12 @@ Theme *proxyTheme() return new Theme(m_creatorTheme); } +// Convenience +QColor creatorColor(Theme::Color role) +{ + return m_creatorTheme->color(role); +} + static bool paletteIsDark(const QPalette &pal) { return pal.color(QPalette::Window).lightnessF() < pal.color(QPalette::WindowText).lightnessF(); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index cd89c3ae48a..59475aff820 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -577,5 +577,6 @@ private: QTCREATOR_UTILS_EXPORT Theme *creatorTheme(); QTCREATOR_UTILS_EXPORT Theme *proxyTheme(); +QTCREATOR_UTILS_EXPORT QColor creatorColor(Theme::Color role); } // namespace Utils diff --git a/src/plugins/appstatisticsmonitor/chart.cpp b/src/plugins/appstatisticsmonitor/chart.cpp index 6388f675cbf..2abf6d1ceb6 100644 --- a/src/plugins/appstatisticsmonitor/chart.cpp +++ b/src/plugins/appstatisticsmonitor/chart.cpp @@ -59,7 +59,7 @@ void Chart::paintEvent(QPaintEvent *event) Q_UNUSED(event); QPainter painter(this); - painter.fillRect(rect(), Utils::creatorTheme()->color(Utils::Theme::Token_Background_Default)); + painter.fillRect(rect(), Utils::creatorColor(Utils::Theme::Token_Background_Default)); // add the name of the chart in the middle of the widget width and on the top painter.drawText( @@ -74,10 +74,10 @@ void Chart::paintEvent(QPaintEvent *event) double xPos = padding + (x - dataRange.left()) * m_xScale; if (xPos < padding || xPos > width() - padding) continue; - painter.setPen(Utils::creatorTheme()->color(Utils::Theme::Token_Foreground_Default)); + painter.setPen(Utils::creatorColor(Utils::Theme::Token_Foreground_Default)); painter.drawLine(xPos, padding, xPos, height() - padding); - painter.setPen(Utils::creatorTheme()->color(Utils::Theme::Token_Text_Muted)); + painter.setPen(Utils::creatorColor(Utils::Theme::Token_Text_Muted)); painter.drawText(xPos, height() - numPadding, QString::number(x)); } @@ -86,18 +86,18 @@ void Chart::paintEvent(QPaintEvent *event) if (yPos < padding || yPos > height() - padding) continue; - painter.setPen(Utils::creatorTheme()->color(Utils::Theme::Token_Foreground_Default)); + painter.setPen(Utils::creatorColor(Utils::Theme::Token_Foreground_Default)); painter.drawLine(padding, yPos, width() - padding, yPos); - painter.setPen(Utils::creatorTheme()->color(Utils::Theme::Token_Text_Muted)); + painter.setPen(Utils::creatorColor(Utils::Theme::Token_Text_Muted)); painter.drawText(numPadding, yPos, QString::number(y)); } - painter.setPen(Utils::creatorTheme()->color(Utils::Theme::Token_Foreground_Default)); + painter.setPen(Utils::creatorColor(Utils::Theme::Token_Foreground_Default)); painter.drawLine(padding, height() - padding, width() - padding, height() - padding); // X axis painter.drawLine(padding, height() - padding, padding, padding); // Y axis - QPen pen(Utils::creatorTheme()->color(Utils::Theme::Token_Accent_Default)); + QPen pen(Utils::creatorColor(Utils::Theme::Token_Accent_Default)); pen.setWidth(2); painter.setPen(pen); painter.setRenderHint(QPainter::Antialiasing); diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp index 435b510f85c..a8e1d98e051 100644 --- a/src/plugins/autotest/testnavigationwidget.cpp +++ b/src/plugins/autotest/testnavigationwidget.cpp @@ -88,8 +88,8 @@ TestNavigationWidget::TestNavigationWidget() m_view->setItemDelegate(new TestTreeItemDelegate(this)); QPalette pal; - pal.setColor(QPalette::Window, creatorTheme()->color(Theme::InfoBarBackground)); - pal.setColor(QPalette::WindowText, creatorTheme()->color(Theme::InfoBarText)); + pal.setColor(QPalette::Window, creatorColor(Theme::InfoBarBackground)); + pal.setColor(QPalette::WindowText, creatorColor(Theme::InfoBarText)); m_missingFrameworksWidget = new QFrame; m_missingFrameworksWidget->setPalette(pal); m_missingFrameworksWidget->setAutoFillBackground(true); diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index 75c3d45f6f2..e1a1c6bc8ad 100644 --- a/src/plugins/autotest/testresult.cpp +++ b/src/plugins/autotest/testresult.cpp @@ -135,33 +135,32 @@ QColor TestResult::colorForType(const ResultType type) if (type >= ResultType::INTERNAL_MESSAGES_BEGIN && type <= ResultType::INTERNAL_MESSAGES_END) return QColor("transparent"); - const Theme *theme = creatorTheme(); switch (type) { case ResultType::Pass: - return theme->color(Theme::OutputPanes_TestPassTextColor); + return creatorColor(Theme::OutputPanes_TestPassTextColor); case ResultType::Fail: - return theme->color(Theme::OutputPanes_TestFailTextColor); + return creatorColor(Theme::OutputPanes_TestFailTextColor); case ResultType::ExpectedFail: - return theme->color(Theme::OutputPanes_TestXFailTextColor); + return creatorColor(Theme::OutputPanes_TestXFailTextColor); case ResultType::UnexpectedPass: - return theme->color(Theme::OutputPanes_TestXPassTextColor); + return creatorColor(Theme::OutputPanes_TestXPassTextColor); case ResultType::Skip: - return theme->color(Theme::OutputPanes_TestSkipTextColor); + return creatorColor(Theme::OutputPanes_TestSkipTextColor); case ResultType::MessageDebug: case ResultType::MessageInfo: - return theme->color(Theme::OutputPanes_TestDebugTextColor); + return creatorColor(Theme::OutputPanes_TestDebugTextColor); case ResultType::MessageWarn: - return theme->color(Theme::OutputPanes_TestWarnTextColor); + return creatorColor(Theme::OutputPanes_TestWarnTextColor); case ResultType::MessageFatal: case ResultType::MessageSystem: case ResultType::MessageError: - return theme->color(Theme::OutputPanes_TestFatalTextColor); + return creatorColor(Theme::OutputPanes_TestFatalTextColor); case ResultType::BlacklistedPass: case ResultType::BlacklistedFail: case ResultType::BlacklistedXPass: case ResultType::BlacklistedXFail: default: - return theme->color(Theme::OutputPanes_StdOutTextColor); + return creatorColor(Theme::OutputPanes_StdOutTextColor); } } diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index aacc1808bfe..894107d5d4b 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -86,8 +86,8 @@ TestResultsPane::TestResultsPane(QObject *parent) : visualOutputWidget->setLayout(outputLayout); QPalette pal; - pal.setColor(QPalette::Window, creatorTheme()->color(Theme::InfoBarBackground)); - pal.setColor(QPalette::WindowText, creatorTheme()->color(Theme::InfoBarText)); + pal.setColor(QPalette::Window, creatorColor(Theme::InfoBarBackground)); + pal.setColor(QPalette::WindowText, creatorColor(Theme::InfoBarText)); m_summaryWidget = new QFrame; m_summaryWidget->setPalette(pal); m_summaryWidget->setAutoFillBackground(true); diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index fd35ed61ff9..80dd5103c14 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -717,7 +717,7 @@ void IssuesWidget::showNoDataOverlay() iconRect.moveCenter(that->rect().center()); icon.paint(&p, iconRect); p.save(); - p.setPen(Utils::creatorTheme()->color(Theme::TextColorDisabled)); + p.setPen(Utils::creatorColor(Theme::TextColorDisabled)); p.drawText(iconRect.bottomRight() + QPoint{10, p.fontMetrics().height() / 2 - 16}, Tr::tr("No Data")); p.restore(); @@ -750,7 +750,7 @@ public: m_outputWidget->addWidget(issuesWidget); QPalette pal = m_outputWidget->palette(); - pal.setColor(QPalette::Window, creatorTheme()->color(Theme::Color::BackgroundColorNormal)); + pal.setColor(QPalette::Window, creatorColor(Theme::Color::BackgroundColorNormal)); m_outputWidget->setPalette(pal); m_showDashboard = new QToolButton(m_outputWidget); diff --git a/src/plugins/axivion/dynamiclistmodel.cpp b/src/plugins/axivion/dynamiclistmodel.cpp index 80419a32234..ecd8b361b2f 100644 --- a/src/plugins/axivion/dynamiclistmodel.cpp +++ b/src/plugins/axivion/dynamiclistmodel.cpp @@ -73,7 +73,7 @@ QVariant DynamicListModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole && index.column() == 0) return Tr::tr("Fetching..."); // TODO improve/customize? if (role == Qt::ForegroundRole && index.column() == 0) - return Utils::creatorTheme()->color(Utils::Theme::TextColorDisabled); + return Utils::creatorColor(Utils::Theme::TextColorDisabled); return {}; } diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 8f837ba2e87..32ee429c4d1 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -144,7 +144,7 @@ private: case Qt::ForegroundRole: if ((detail().endsWith("class") || detail().endsWith("struct")) && range().end() == selectionRange().end()) { - return creatorTheme()->color(Theme::TextColorDisabled); + return creatorColor(Theme::TextColorDisabled); } break; } diff --git a/src/plugins/clangtools/clangtool.cpp b/src/plugins/clangtools/clangtool.cpp index dd4c7612bd8..21b5ea6fbdc 100644 --- a/src/plugins/clangtools/clangtool.cpp +++ b/src/plugins/clangtools/clangtool.cpp @@ -136,8 +136,8 @@ public: setLayout(layout); QPalette pal; - pal.setColor(QPalette::Window, Utils::creatorTheme()->color(Theme::InfoBarBackground)); - pal.setColor(QPalette::WindowText, Utils::creatorTheme()->color(Theme::InfoBarText)); + pal.setColor(QPalette::Window, Utils::creatorColor(Theme::InfoBarBackground)); + pal.setColor(QPalette::WindowText, Utils::creatorColor(Theme::InfoBarText)); setPalette(pal); setAutoFillBackground(true); diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index 30fd1f613c4..618c42892f2 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -179,7 +179,7 @@ void CMakeProcess::stop() QString addCMakePrefix(const QString &str) { static const QString prefix - = ansiColoredText(Constants::OUTPUT_PREFIX, creatorTheme()->color(Theme::Token_Text_Muted)); + = ansiColoredText(Constants::OUTPUT_PREFIX, creatorColor(Theme::Token_Text_Muted)); return prefix + str; } diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index 953486e2dad..287615650ca 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -570,8 +570,8 @@ QVariant ConfigModelTreeItem::data(int column, int role) const mismatch = !dataItem->kitValue.isEmpty() && dataItem->kitValue != value; else mismatch = !dataItem->initialValue.isEmpty() && dataItem->initialValue != value; - return Utils::creatorTheme()->color(mismatch ? Utils::Theme::TextColorError - : Utils::Theme::TextColorNormal); + return Utils::creatorColor(mismatch ? Utils::Theme::TextColorError + : Utils::Theme::TextColorNormal); }; const QString value = currentValue(); diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index f14ebf4dbff..340cc7ba2ce 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -423,27 +423,27 @@ SearchableTerminal *CompilerWidget::createTerminal() { m_resultTerminal = new SearchableTerminal(); m_resultTerminal->setAllowBlinkingCursor(false); - std::array colors{Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi0), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi1), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi2), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi3), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi4), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi5), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi6), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi7), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi8), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi9), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi10), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi11), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi12), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi13), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi14), - Utils::creatorTheme()->color(Utils::Theme::TerminalAnsi15), + std::array colors{Utils::creatorColor(Utils::Theme::TerminalAnsi0), + Utils::creatorColor(Utils::Theme::TerminalAnsi1), + Utils::creatorColor(Utils::Theme::TerminalAnsi2), + Utils::creatorColor(Utils::Theme::TerminalAnsi3), + Utils::creatorColor(Utils::Theme::TerminalAnsi4), + Utils::creatorColor(Utils::Theme::TerminalAnsi5), + Utils::creatorColor(Utils::Theme::TerminalAnsi6), + Utils::creatorColor(Utils::Theme::TerminalAnsi7), + Utils::creatorColor(Utils::Theme::TerminalAnsi8), + Utils::creatorColor(Utils::Theme::TerminalAnsi9), + Utils::creatorColor(Utils::Theme::TerminalAnsi10), + Utils::creatorColor(Utils::Theme::TerminalAnsi11), + Utils::creatorColor(Utils::Theme::TerminalAnsi12), + Utils::creatorColor(Utils::Theme::TerminalAnsi13), + Utils::creatorColor(Utils::Theme::TerminalAnsi14), + Utils::creatorColor(Utils::Theme::TerminalAnsi15), - Utils::creatorTheme()->color(Utils::Theme::TerminalForeground), - Utils::creatorTheme()->color(Utils::Theme::TerminalBackground), - Utils::creatorTheme()->color(Utils::Theme::TerminalSelection), - Utils::creatorTheme()->color(Utils::Theme::TerminalFindMatch)}; + Utils::creatorColor(Utils::Theme::TerminalForeground), + Utils::creatorColor(Utils::Theme::TerminalBackground), + Utils::creatorColor(Utils::Theme::TerminalSelection), + Utils::creatorColor(Utils::Theme::TerminalFindMatch)}; m_resultTerminal->setColors(colors); diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 4f7c0fb0067..8649adc1679 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -341,7 +341,7 @@ ShortcutInput::ShortcutInput() QPalette palette = m_warningLabel->palette(); palette.setColor(QPalette::Active, QPalette::WindowText, - Utils::creatorTheme()->color(Utils::Theme::TextColorError)); + Utils::creatorColor(Utils::Theme::TextColorError)); m_warningLabel->setPalette(palette); connect(m_warningLabel, &QLabel::linkActivated, this, &ShortcutInput::showConflictsRequested); @@ -718,15 +718,15 @@ bool ShortcutSettingsWidget::markCollisions(ShortcutItem *item, int index) } if (currentIsConflicting) { currentItem->m_item->setForeground(2, - Utils::creatorTheme()->color( - Utils::Theme::TextColorError)); + Utils::creatorColor( + Utils::Theme::TextColorError)); hasCollision = true; } } } item->m_item->setForeground(2, hasCollision - ? Utils::creatorTheme()->color(Utils::Theme::TextColorError) + ? Utils::creatorColor(Utils::Theme::TextColorError) : commandList()->palette().windowText()); return hasCollision; } diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index a086270ffd5..15a6e810576 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -297,11 +297,11 @@ void EditorView::paintEvent(QPaintEvent *) QRect rect = m_container->geometry(); if (creatorTheme()->flag(Theme::FlatToolBars)) { - painter.fillRect(rect, creatorTheme()->color(Theme::EditorPlaceholderColor)); + painter.fillRect(rect, creatorColor(Theme::EditorPlaceholderColor)); } else { painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(Qt::NoPen); - painter.setBrush(creatorTheme()->color(Theme::EditorPlaceholderColor)); + painter.setBrush(creatorColor(Theme::EditorPlaceholderColor)); const int r = 3; painter.drawRoundedRect(rect.adjusted(r , r, -r, -r), r * 2, r * 2); } diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 7197236100d..9a873b1af32 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -141,7 +141,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event) && m_fader > 0 && isEnabled() && !isDown() && !isChecked()) { painter.save(); if (creatorTheme()->flag(Theme::FlatToolBars)) { - const QColor hoverColor = creatorTheme()->color(Theme::FancyToolButtonHoverColor); + const QColor hoverColor = creatorColor(Theme::FancyToolButtonHoverColor); QColor fadedHoverColor = hoverColor; fadedHoverColor.setAlpha(int(m_fader * hoverColor.alpha())); painter.fillRect(rect(), fadedHoverColor); @@ -152,7 +152,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event) painter.restore(); } else if (isDown() || isChecked()) { painter.save(); - const QColor selectedColor = creatorTheme()->color(Theme::FancyToolButtonSelectedColor); + const QColor selectedColor = creatorColor(Theme::FancyToolButtonSelectedColor); if (creatorTheme()->flag(Theme::FlatToolBars)) { painter.fillRect(rect(), selectedColor); } else { @@ -200,8 +200,8 @@ void FancyToolButton::paintEvent(QPaintEvent *event) - QPoint(iconRect.width() / 2, iconRect.height() / 2); textOffset = textOffset - QPoint(0, lineHeight + 3); const QRectF r(0, textOffset.y(), rect().width(), lineHeight); - painter.setPen(creatorTheme()->color(isEnabled() ? Theme::PanelTextColorLight - : Theme::IconsDisabledColor)); + painter.setPen(creatorColor(isEnabled() ? Theme::PanelTextColorLight + : Theme::IconsDisabledColor)); // draw project name const int margin = 6; @@ -227,12 +227,12 @@ void FancyToolButton::paintEvent(QPaintEvent *event) // draw the two text lines for the build configuration painter.setPen( - creatorTheme()->color(isEnabled() - // Intentionally using the "Unselected" colors, - // because the text color won't change in the pressed - // state as they would do on the mode buttons. - ? Theme::FancyTabWidgetEnabledUnselectedTextColor - : Theme::FancyTabWidgetDisabledUnselectedTextColor)); + creatorColor(isEnabled() + // Intentionally using the "Unselected" colors, + // because the text color won't change in the pressed + // state as they would do on the mode buttons. + ? Theme::FancyTabWidgetEnabledUnselectedTextColor + : Theme::FancyTabWidgetDisabledUnselectedTextColor)); for (int i = 0; i < 2; ++i) { const QString &buildConfigText = splitBuildConfiguration[i]; @@ -264,7 +264,7 @@ void FancyActionBar::paintEvent(QPaintEvent *event) // this paints the background of the bottom portion of the // left tab bar painter.fillRect(event->rect(), StyleHelper::baseColor()); - painter.setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor)); + painter.setPen(creatorColor(Theme::FancyToolBarSeparatorColor)); painter.drawLine(borderRect.topLeft(), borderRect.topRight()); } else { painter.setPen(StyleHelper::sidebarShadow()); @@ -320,7 +320,7 @@ void FancyToolButton::hoverOverlay(QPainter *painter, const QRect &spanRect) overlay.fill(Qt::transparent); overlay.setDevicePixelRatio(dpr); - const QColor hoverColor = creatorTheme()->color(Theme::FancyToolButtonHoverColor); + const QColor hoverColor = creatorColor(Theme::FancyToolButtonHoverColor); const QRect rect(QPoint(), logicalSize); const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5); diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 46d4d311356..18d4603e19e 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -272,7 +272,7 @@ static void paintIcon(QPainter *painter, const QRect &rect, painter->setOpacity(1.0); QRect accentRect = rect; accentRect.setWidth(2); - painter->fillRect(accentRect, creatorTheme()->color(Theme::IconsBaseColor)); + painter->fillRect(accentRect, creatorColor(Theme::IconsBaseColor)); } } @@ -302,16 +302,16 @@ static void paintIconAndText(QPainter *painter, const QRect &rect, if (selected && creatorTheme()->flag(Theme::FlatToolBars)) { QRect accentRect = rect; accentRect.setWidth(2); - painter->fillRect(accentRect, creatorTheme()->color(Theme::IconsBaseColor)); + painter->fillRect(accentRect, creatorColor(Theme::IconsBaseColor)); } if (enabled) { painter->setPen( - selected ? creatorTheme()->color(Theme::FancyTabWidgetEnabledSelectedTextColor) - : creatorTheme()->color(Theme::FancyTabWidgetEnabledUnselectedTextColor)); + selected ? creatorColor(Theme::FancyTabWidgetEnabledSelectedTextColor) + : creatorColor(Theme::FancyTabWidgetEnabledUnselectedTextColor)); } else { painter->setPen( - selected ? creatorTheme()->color(Theme::FancyTabWidgetDisabledSelectedTextColor) - : creatorTheme()->color(Theme::FancyTabWidgetDisabledUnselectedTextColor)); + selected ? creatorColor(Theme::FancyTabWidgetDisabledSelectedTextColor) + : creatorColor(Theme::FancyTabWidgetDisabledUnselectedTextColor)); } painter->translate(0, -1); @@ -338,7 +338,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const if (selected) { if (creatorTheme()->flag(Theme::FlatToolBars)) { // background color of a fancy tab that is active - painter->fillRect(rect, creatorTheme()->color(Theme::FancyTabBarSelectedBackgroundColor)); + painter->fillRect(rect, creatorColor(Theme::FancyTabBarSelectedBackgroundColor)); } else { paintSelectedTabBackground(painter, rect); } @@ -349,7 +349,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const painter->save(); painter->setOpacity(fader); if (creatorTheme()->flag(Theme::FlatToolBars)) - painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor)); + painter->fillRect(rect, creatorColor(Theme::FancyToolButtonHoverColor)); else FancyToolButton::hoverOverlay(painter, rect); painter->restore(); diff --git a/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp b/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp index a88b8e4fba5..dc45883b91a 100644 --- a/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp +++ b/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp @@ -193,7 +193,7 @@ void HighlightScrollBarOverlay::drawHighlights(QPainter *painter, for (const QMap> &colors : std::as_const(m_highlightCache)) { const auto itColorEnd = colors.constEnd(); for (auto itColor = colors.constBegin(); itColor != itColorEnd; ++itColor) { - const QColor &color = creatorTheme()->color(itColor.key()); + const QColor &color = creatorColor(itColor.key()); const QMap &positions = itColor.value(); const auto itPosEnd = positions.constEnd(); const auto firstPos = int(docStart / lineHeight); diff --git a/src/plugins/coreplugin/find/searchresultwidget.cpp b/src/plugins/coreplugin/find/searchresultwidget.cpp index c7827e6118e..e206fb3879c 100644 --- a/src/plugins/coreplugin/find/searchresultwidget.cpp +++ b/src/plugins/coreplugin/find/searchresultwidget.cpp @@ -67,8 +67,8 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : QFrame *topWidget = new QFrame; QPalette pal; - pal.setColor(QPalette::Window, creatorTheme()->color(Theme::InfoBarBackground)); - pal.setColor(QPalette::WindowText, creatorTheme()->color(Theme::InfoBarText)); + pal.setColor(QPalette::Window, creatorColor(Theme::InfoBarBackground)); + pal.setColor(QPalette::WindowText, creatorColor(Theme::InfoBarText)); topWidget->setPalette(pal); if (creatorTheme()->flag(Theme::DrawSearchResultWidgetFrame)) { topWidget->setFrameStyle(QFrame::Panel | QFrame::Raised); diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp index 20adfda16bb..544c25a17e1 100644 --- a/src/plugins/coreplugin/iwizardfactory.cpp +++ b/src/plugins/coreplugin/iwizardfactory.cpp @@ -464,7 +464,7 @@ static QIcon iconWithText(const QIcon &icon, const QString &text) font.setPixelSize(fontSize); font.setStretch(85); QPainter p(&pixmap); - p.setPen(Utils::creatorTheme()->color(Theme::PanelTextColorDark)); + p.setPen(Utils::creatorColor(Theme::PanelTextColorDark)); p.setFont(font); QTextOption textOption(Qt::AlignHCenter | Qt::AlignBottom); textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index e6acfee42f7..c5444344a69 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -57,8 +57,8 @@ public: LocatorModel(QObject *parent = nullptr) : QAbstractListModel(parent) - , m_backgroundColor(Utils::creatorTheme()->color(Theme::TextColorHighlightBackground)) - , m_foregroundColor(Utils::creatorTheme()->color(Theme::TextColorNormal)) + , m_backgroundColor(Utils::creatorColor(Theme::TextColorHighlightBackground)) + , m_foregroundColor(Utils::creatorColor(Theme::TextColorNormal)) {} void clear(); diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index c4cba4845b8..390970eb84e 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -269,15 +269,15 @@ void ManhattanStyle::unpolish(QApplication *app) QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false) { - QColor color = creatorTheme()->color(lightColored ? Theme::PanelTextColorDark - : Theme::PanelTextColorLight); + QColor color = creatorColor(lightColored ? Theme::PanelTextColorDark + : Theme::PanelTextColorLight); QPalette pal = oldPalette; pal.setBrush(QPalette::All, QPalette::WindowText, color); pal.setBrush(QPalette::All, QPalette::ButtonText, color); if (lightColored) color.setAlpha(100); else - color = creatorTheme()->color(Theme::IconsDisabledColor); + color = creatorColor(Theme::IconsDisabledColor); pal.setBrush(QPalette::Disabled, QPalette::WindowText, color); pal.setBrush(QPalette::Disabled, QPalette::ButtonText, color); return pal; @@ -328,7 +328,7 @@ void ManhattanStyle::polish(QWidget *widget) QPalette palette = panelPalette(widget->palette(), isLightColored); if (!isLightColored) palette.setBrush(QPalette::All, QPalette::WindowText, - creatorTheme()->color(Theme::ComboBoxTextColor)); + creatorColor(Theme::ComboBoxTextColor)); widget->setPalette(palette); widget->setMaximumHeight(height - 2); widget->setAttribute(Qt::WA_Hover); @@ -450,9 +450,9 @@ static void drawPrimitiveTweakedForDarkTheme(QStyle::PrimitiveElement element, const bool isSunken = option->state & QStyle::State_Sunken; const QColor frameColor = isEnabled ? option->palette.color(QPalette::Mid).darker(132) - : creatorTheme()->color(Theme::BackgroundColorDisabled); + : creatorColor(Theme::BackgroundColorDisabled); const QColor indicatorColor = isEnabled ? option->palette.color(QPalette::Mid).darker(90) - : creatorTheme()->color(Theme::BackgroundColorDisabled); + : creatorColor(Theme::BackgroundColorDisabled); const QColor bgColor = isSunken ? option->palette.color(QPalette::Mid).darker() : option->palette.color(QPalette::Window); const QColor hlColor = option->palette.color(QPalette::Highlight); @@ -613,7 +613,7 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element, QRect rect = option->rect; switch (element) { case PE_IndicatorDockWidgetResizeHandle: - painter->fillRect(option->rect, creatorTheme()->color(Theme::DockWidgetResizeHandleColor)); + painter->fillRect(option->rect, creatorColor(Theme::DockWidgetResizeHandleColor)); break; case PE_FrameDockWidget: QCommonStyle::drawPrimitive(element, option, painter, widget); @@ -631,7 +631,7 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element, painter->setOpacity(0.75); QBrush baseBrush = option->palette.base(); if (widget && qobject_cast(widget->parentWidget())) - baseBrush = creatorTheme()->color(Theme::DScontrolBackgroundDisabled); + baseBrush = creatorColor(Theme::DScontrolBackgroundDisabled); painter->fillRect(backgroundRect, baseBrush); painter->restore(); } else { @@ -725,7 +725,7 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element, painter->setPen(StyleHelper::sidebarShadow()); if (pressed) { StyleHelper::drawPanelBgRect( - painter, rect, creatorTheme()->color(Theme::FancyToolButtonSelectedColor)); + painter, rect, creatorColor(Theme::FancyToolButtonSelectedColor)); if (StyleHelper::toolbarStyle() == StyleHelper::ToolbarStyleCompact && !creatorTheme()->flag(Theme::FlatToolBars)) { const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5); @@ -736,13 +736,13 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element, } else if (option->state & State_Enabled && option->state & State_MouseOver) { if (widget->property(StyleHelper::C_TOOLBAR_ACTIONWIDGET).toBool()) { painter->save(); - painter->setBrush(creatorTheme()->color(Theme::FancyToolButtonHoverColor)); + painter->setBrush(creatorColor(Theme::FancyToolButtonHoverColor)); painter->drawRoundedRect(rect, 5, 5); painter->restore(); } else { StyleHelper::drawPanelBgRect(painter, rect, - creatorTheme()->color( + creatorColor( Theme::FancyToolButtonHoverColor)); } } @@ -868,9 +868,8 @@ void ManhattanStyle::drawControl( const bool enabled = mbi->state & State_Enabled; QStyleOptionMenuItem item = *mbi; item.rect = mbi->rect; - const QColor color = creatorTheme()->color(enabled - ? Theme::MenuItemTextColorNormal - : Theme::MenuItemTextColorDisabled); + const QColor color = creatorColor(enabled ? Theme::MenuItemTextColorNormal + : Theme::MenuItemTextColorDisabled); if (color.isValid()) { QPalette pal = mbi->palette; pal.setBrush(QPalette::Text, color); @@ -897,24 +896,23 @@ void ManhattanStyle::drawControl( item.rect = mbi->rect; QPalette pal = mbi->palette; pal.setBrush(QPalette::ButtonText, dis - ? creatorTheme()->color(Theme::MenuBarItemTextColorDisabled) - : creatorTheme()->color(Theme::MenuBarItemTextColorNormal)); + ? creatorColor(Theme::MenuBarItemTextColorDisabled) + : creatorColor(Theme::MenuBarItemTextColorNormal)); item.palette = pal; QCommonStyle::drawControl(element, &item, painter, widget); if (act) { // Fill| const QColor fillColor = StyleHelper::alphaBlendedColors( - StyleHelper::baseColor(), creatorTheme()->color(Theme::FancyToolButtonHoverColor)); + StyleHelper::baseColor(), creatorColor(Theme::FancyToolButtonHoverColor)); painter->fillRect(option->rect, fillColor); QPalette pal = mbi->palette; uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; if (!styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - pal.setBrush(QPalette::Text, creatorTheme()->color(dis - ? Theme::IconsDisabledColor - : Theme::PanelTextColorLight)); + pal.setBrush(QPalette::Text, creatorColor(dis ? Theme::IconsDisabledColor + : Theme::PanelTextColorLight)); drawItemText(painter, item.rect, alignment, pal, !dis, mbi->text, QPalette::Text); } } @@ -981,7 +979,7 @@ void ManhattanStyle::drawControl( } painter->setPen((option->state & State_Enabled) ? option->palette.color(QPalette::WindowText) - : creatorTheme()->color(Theme::IconsDisabledColor)); + : creatorColor(Theme::IconsDisabledColor)); painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text); painter->restore(); @@ -1072,7 +1070,7 @@ void ManhattanStyle::drawControl( // toolbar should draw the top or bottom outline // (needed for the find toolbar for instance) const QColor hightLight = creatorTheme()->flag(Theme::FlatToolBars) - ? creatorTheme()->color(Theme::FancyToolBarSeparatorColor) + ? creatorColor(Theme::FancyToolBarSeparatorColor) : StyleHelper::sidebarHighlight(); const QColor borderColor = drawLightColored ? QColor(255, 255, 255, 180) : hightLight; @@ -1158,7 +1156,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti label.palette = panelPalette(option->palette, lightColored(widget)); if (widget && widget->property(StyleHelper::C_HIGHLIGHT_WIDGET).toBool()) { label.palette.setColor(QPalette::ButtonText, - creatorTheme()->color(Theme::IconsWarningToolBarColor)); + creatorColor(Theme::IconsWarningToolBarColor)); } int fw = pixelMetric(PM_DefaultFrameWidth, option, widget); label.rect = button.adjusted(fw, fw, -fw, -fw); @@ -1270,7 +1268,7 @@ void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, b const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5); if (creatorTheme()->flag(Theme::FlatToolBars)) { const int margin = 3; - painter->setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor)); + painter->setPen(creatorColor(Theme::FancyToolBarSeparatorColor)); painter->drawLine(borderRect.topRight() + QPointF(0, margin), borderRect.bottomRight() - QPointF(0, margin)); } else { diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index cdf6d16d8e2..56adc7a6084 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -138,7 +138,7 @@ void MiniSplitterHandle::resizeEvent(QResizeEvent *event) void MiniSplitterHandle::paintEvent(QPaintEvent *event) { QPainter painter(this); - const QColor color = Utils::creatorTheme()->color( + const QColor color = Utils::creatorColor( m_lightColored ? Utils::Theme::FancyToolBarSeparatorColor : Utils::Theme::SplitterColor); painter.fillRect(event->rect(), color); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 90475d3abc8..a5495612d5c 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -940,7 +940,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*) c = Theme::BackgroundColorSelected; if (c != Theme::BackgroundColorDark) - StyleHelper::drawPanelBgRect(&p, bgRect(rect()), creatorTheme()->color(c)); + StyleHelper::drawPanelBgRect(&p, bgRect(rect()), creatorColor(c)); } else { const QImage *image = nullptr; if (isDown()) { @@ -974,7 +974,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*) if (m_flashTimer->state() == QTimeLine::Running) { - QColor c = creatorTheme()->color(Theme::OutputPaneButtonFlashColor); + QColor c = creatorColor(Theme::OutputPaneButtonFlashColor); c.setAlpha (m_flashTimer->currentFrame()); if (creatorTheme()->flag(Theme::FlatToolBars)) StyleHelper::drawPanelBgRect(&p, bgRect(rect()), c); @@ -983,10 +983,10 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*) } p.setFont(font()); - p.setPen(creatorTheme()->color(Theme::OutputPaneToggleButtonTextColorChecked)); + p.setPen(creatorColor(Theme::OutputPaneToggleButtonTextColorChecked)); p.drawText((numberAreaWidth() - numberWidth) / 2, baseLine, m_number); if (!isChecked()) - p.setPen(creatorTheme()->color(Theme::OutputPaneToggleButtonTextColorUnchecked)); + p.setPen(creatorColor(Theme::OutputPaneToggleButtonTextColorUnchecked)); int leftPart = numberAreaWidth() + buttonBorderWidth; int labelWidth = 0; if (!m_badgeNumberLabel.text().isEmpty()) { @@ -1083,15 +1083,15 @@ void BadgeLabel::paint(QPainter *p, int x, int y, bool isChecked) const QRectF rect(QRect(QPoint(x, y), m_size)); p->save(); - p->setBrush(creatorTheme()->color(isChecked? Theme::BadgeLabelBackgroundColorChecked - : Theme::BadgeLabelBackgroundColorUnchecked)); + p->setBrush(creatorColor(isChecked? Theme::BadgeLabelBackgroundColorChecked + : Theme::BadgeLabelBackgroundColorUnchecked)); p->setPen(Qt::NoPen); p->setRenderHint(QPainter::Antialiasing, true); p->drawRoundedRect(rect, m_padding, m_padding, Qt::AbsoluteSize); p->setFont(m_font); - p->setPen(creatorTheme()->color(isChecked ? Theme::BadgeLabelTextColorChecked - : Theme::BadgeLabelTextColorUnchecked)); + p->setPen(creatorColor(isChecked ? Theme::BadgeLabelTextColorChecked + : Theme::BadgeLabelTextColorUnchecked)); p->drawText(rect, Qt::AlignCenter, m_text); p->restore(); diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index 62459bcfea1..c798575af23 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -308,7 +308,7 @@ void FutureProgress::paintEvent(QPaintEvent *) QPainter p(this); if (creatorTheme()->flag(Theme::FlatToolBars)) { p.fillRect(rect(), StyleHelper::baseColor()); - p.fillRect(rect(), creatorTheme()->color(Theme::FancyToolButtonSelectedColor)); + p.fillRect(rect(), creatorColor(Theme::FancyToolButtonSelectedColor)); } else { QLinearGradient grad = StyleHelper::statusBarGradient(rect()); p.fillRect(rect(), grad); diff --git a/src/plugins/coreplugin/progressmanager/progressbar.cpp b/src/plugins/coreplugin/progressmanager/progressbar.cpp index e63a21efdd3..5047fa66003 100644 --- a/src/plugins/coreplugin/progressmanager/progressbar.cpp +++ b/src/plugins/coreplugin/progressmanager/progressbar.cpp @@ -245,7 +245,7 @@ void ProgressBar::paintEvent(QPaintEvent *) textRect.setHeight(fm.height() + 4); p.setFont(fnt); - p.setPen(creatorTheme()->color(Theme::ProgressBarTitleColor)); + p.setPen(creatorColor(Theme::ProgressBarTitleColor)); p.drawText(textRect, alignment | Qt::AlignBottom, elidedtitle); if (!m_subtitle.isEmpty()) { @@ -255,7 +255,7 @@ void ProgressBar::paintEvent(QPaintEvent *) subtextRect.moveTop(progressY + progressHeight); p.setFont(fnt); - p.setPen(creatorTheme()->color(Theme::ProgressBarTitleColor)); + p.setPen(creatorColor(Theme::ProgressBarTitleColor)); p.drawText(subtextRect, alignment | Qt::AlignBottom, elidedsubtitle); } } @@ -274,12 +274,11 @@ void ProgressBar::paintEvent(QPaintEvent *) themeColor = Theme::ProgressBarColorError; else if (m_finished) themeColor = Theme::ProgressBarColorFinished; - const QColor c = creatorTheme()->color(themeColor); + const QColor c = creatorColor(themeColor); //draw the progress bar if (creatorTheme()->flag(Theme::FlatToolBars)) { - p.fillRect(rect.adjusted(2, 2, -2, -2), - creatorTheme()->color(Theme::ProgressBarBackgroundColor)); + p.fillRect(rect.adjusted(2, 2, -2, -2), creatorColor(Theme::ProgressBarBackgroundColor)); p.fillRect(inner, c); } else { const static QImage bar(StyleHelper::dpiSpecificImageFile( diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index c2b28c1f83e..63ec6745b5e 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -41,7 +41,7 @@ using namespace StyleHelper::SpacingTokens; static QColor themeColor(Theme::Color role) { - return creatorTheme()->color(role); + return creatorColor(role); } namespace WelcomePageHelpers { @@ -51,7 +51,7 @@ void setBackgroundColor(QWidget *widget, Theme::Color colorRole) QPalette palette = creatorTheme()->palette(); const QPalette::ColorRole role = QPalette::Window; palette.setBrush(role, {}); - palette.setColor(role, creatorTheme()->color(colorRole)); + palette.setColor(role, creatorColor(colorRole)); widget->setPalette(palette); widget->setBackgroundRole(role); widget->setAutoFillBackground(true); @@ -195,23 +195,23 @@ void Button::paintEvent(QPaintEvent *event) switch (m_role) { case MediumPrimary: case SmallPrimary: { - const QBrush fill(creatorTheme()->color(isDown() - ? Theme::Token_Accent_Subtle - : hovered ? Theme::Token_Accent_Muted - : Theme::Token_Accent_Default)); + const QBrush fill(creatorColor(isDown() + ? Theme::Token_Accent_Subtle + : hovered ? Theme::Token_Accent_Muted + : Theme::Token_Accent_Default)); drawCardBackground(&p, bgR, fill, QPen(Qt::NoPen), brRectRounding); break; } case MediumSecondary: case SmallSecondary: { - const QPen outline(creatorTheme()->color(Theme::Token_Text_Default), hovered ? 2 : 1); + const QPen outline(creatorColor(Theme::Token_Text_Default), hovered ? 2 : 1); drawCardBackground(&p, bgR, QBrush(Qt::NoBrush), outline, brRectRounding); break; } case SmallList: { if (isChecked() || hovered) { - const QBrush fill(creatorTheme()->color(isChecked() ? Theme::Token_Foreground_Muted - : Theme::Token_Foreground_Subtle)); + const QBrush fill(creatorColor(isChecked() ? Theme::Token_Foreground_Muted + : Theme::Token_Foreground_Subtle)); drawCardBackground(&p, bgR, fill, QPen(Qt::NoPen), brRectRounding); } break; @@ -329,11 +329,11 @@ void SearchBox::leaveEvent(QEvent *event) static void paintCommonBackground(QPainter *p, const QRectF &rect, const QWidget *widget) { - const QBrush fill(creatorTheme()->color(Theme::Token_Background_Muted)); + const QBrush fill(creatorColor(Theme::Token_Background_Muted)); const Theme::Color c = widget->hasFocus() ? Theme::Token_Stroke_Strong : widget->underMouse() ? Theme::Token_Stroke_Muted : Theme::Token_Stroke_Subtle; - const QPen pen(creatorTheme()->color(c)); + const QPen pen(creatorColor(c)); drawCardBackground(p, rect, fill, pen); } diff --git a/src/plugins/coreplugin/welcomepagehelper.h b/src/plugins/coreplugin/welcomepagehelper.h index c32e803029e..eb3082129a1 100644 --- a/src/plugins/coreplugin/welcomepagehelper.h +++ b/src/plugins/coreplugin/welcomepagehelper.h @@ -31,11 +31,12 @@ namespace WelcomePageHelpers { constexpr QSize WelcomeThumbnailSize(214, 160); -class CORE_EXPORT TextFormat { +class CORE_EXPORT TextFormat +{ public: QColor color() const { - return Utils::creatorTheme()->color(themeColor); + return Utils::creatorColor(themeColor); } QFont font(bool underlined = false) const diff --git a/src/plugins/cppeditor/cppoutlinemodel.cpp b/src/plugins/cppeditor/cppoutlinemodel.cpp index c03236f274e..6cd11c6df54 100644 --- a/src/plugins/cppeditor/cppoutlinemodel.cpp +++ b/src/plugins/cppeditor/cppoutlinemodel.cpp @@ -117,7 +117,7 @@ public: return false; }; if (isFwdDecl()) - return Utils::creatorTheme()->color(Utils::Theme::TextColorDisabled); + return Utils::creatorColor(Utils::Theme::TextColorDisabled); return TreeItem::data(column, role); } diff --git a/src/plugins/debugger/console/consoleitemdelegate.cpp b/src/plugins/debugger/console/consoleitemdelegate.cpp index 8f76704b703..cd7ead6de8e 100644 --- a/src/plugins/debugger/console/consoleitemdelegate.cpp +++ b/src/plugins/debugger/console/consoleitemdelegate.cpp @@ -53,7 +53,6 @@ QColor ConsoleItemDelegate::drawBackground(QPainter *painter, const QRect &rect, void ConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - const Utils::Theme *theme = Utils::creatorTheme(); QStyleOptionViewItem opt = option; initStyleOption(&opt, index); painter->save(); @@ -65,23 +64,23 @@ void ConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o ConsoleItem::TypeRole).toInt(); switch (type) { case ConsoleItem::DebugType: - textColor = theme->color(Utils::Theme::OutputPanes_NormalMessageTextColor); + textColor = creatorColor(Utils::Theme::OutputPanes_NormalMessageTextColor); taskIcon = m_logIcon; break; case ConsoleItem::WarningType: - textColor = theme->color(Utils::Theme::OutputPanes_WarningMessageTextColor); + textColor = creatorColor(Utils::Theme::OutputPanes_WarningMessageTextColor); taskIcon = m_warningIcon; break; case ConsoleItem::ErrorType: - textColor = theme->color(Utils::Theme::OutputPanes_ErrorMessageTextColor); + textColor = creatorColor(Utils::Theme::OutputPanes_ErrorMessageTextColor); taskIcon = m_errorIcon; break; case ConsoleItem::InputType: - textColor = theme->color(Utils::Theme::TextColorNormal); + textColor = creatorColor(Utils::Theme::TextColorNormal); taskIcon = m_prompt; break; default: - textColor = theme->color(Utils::Theme::TextColorNormal); + textColor = creatorColor(Utils::Theme::TextColorNormal); break; } diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 482f2605e77..7176ce62e2c 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -101,26 +101,25 @@ private: { using Utils::Theme; QTextCharFormat format; - Theme *theme = Utils::creatorTheme(); switch (channelForChar(text.isEmpty() ? QChar() : text.at(0))) { case LogInput: - format.setForeground(theme->color(Theme::Debugger_LogWindow_LogInput)); + format.setForeground(creatorColor(Theme::Debugger_LogWindow_LogInput)); setFormat(1, text.size(), format); break; case LogStatus: - format.setForeground(theme->color(Theme::Debugger_LogWindow_LogStatus)); + format.setForeground(creatorColor(Theme::Debugger_LogWindow_LogStatus)); setFormat(1, text.size(), format); break; case LogWarning: - format.setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor)); + format.setForeground(creatorColor(Theme::OutputPanes_WarningMessageTextColor)); setFormat(1, text.size(), format); break; case LogError: - format.setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor)); + format.setForeground(creatorColor(Theme::OutputPanes_ErrorMessageTextColor)); setFormat(1, text.size(), format); break; case LogTime: - format.setForeground(theme->color(Theme::Debugger_LogWindow_LogTime)); + format.setForeground(creatorColor(Theme::Debugger_LogWindow_LogTime)); setFormat(1, text.size(), format); break; default: @@ -156,7 +155,7 @@ private: Theme *theme = Utils::creatorTheme(); if (text.size() > 3 && text.at(2) == ':') { QTextCharFormat format; - format.setForeground(theme->color(Theme::Debugger_LogWindow_LogTime)); + format.setForeground(creatorColor(Theme::Debugger_LogWindow_LogTime)); setFormat(1, text.size(), format); } } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 0fd0d535f6c..c5600cd9ee8 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -978,7 +978,7 @@ static QColor valueColor(const WatchItem *item, int column) color = Theme::Debugger_WatchItem_ValueChanged; } } - return creatorTheme()->color(color); + return creatorColor(color); } static DisplayFormats typeFormatList(const WatchItem *item) diff --git a/src/plugins/extensionmanager/extensionmanagerwidget.cpp b/src/plugins/extensionmanager/extensionmanagerwidget.cpp index 12a31e6368c..027378ede1c 100644 --- a/src/plugins/extensionmanager/extensionmanagerwidget.cpp +++ b/src/plugins/extensionmanager/extensionmanagerwidget.cpp @@ -119,11 +119,11 @@ void ExtensionManagerWidget::updateView(const QModelIndex ¤t, const QString h6CapitalCss = StyleHelper::fontToCssProperties(StyleHelper::uiFont(StyleHelper::UiElementH6Capital)) + QString::fromLatin1("; color: %1;") - .arg(creatorTheme()->color(Theme::Token_Text_Muted).name()); + .arg(creatorColor(Theme::Token_Text_Muted).name()); const QString bodyStyle = QString::fromLatin1("color: %1; background-color: %2;" "margin-left: %3px; margin-right: %3px;") - .arg(creatorTheme()->color(Theme::Token_Text_Default).name()) - .arg(creatorTheme()->color(Theme::Token_Background_Muted).name()) + .arg(creatorColor(Theme::Token_Text_Default).name()) + .arg(creatorColor(Theme::Token_Background_Muted).name()) .arg(StyleHelper::SpacingTokens::ExVPaddingGapXl); const QString htmlStart = QString(R"( @@ -188,7 +188,7 @@ void ExtensionManagerWidget::updateView(const QModelIndex ¤t, const QString examplesBoxCss = QString::fromLatin1("height: 168px; background-color: %1; ") - .arg(creatorTheme()->color(Theme::Token_Background_Default).name()); + .arg(creatorColor(Theme::Token_Background_Default).name()); description.append(QString(R"(
%2

@@ -240,7 +240,7 @@ void ExtensionManagerWidget::updateView(const QModelIndex ¤t, const QString tagTemplate = QString(R"( %2 - )").arg(creatorTheme()->color(Theme::Token_Stroke_Subtle).name()); + )").arg(creatorColor(Theme::Token_Stroke_Subtle).name()); const QStringList tags = Utils::transform(data.tags, [&tagTemplate] (const QString &tag) { return tagTemplate.arg(tag); diff --git a/src/plugins/extensionmanager/extensionsbrowser.cpp b/src/plugins/extensionmanager/extensionsbrowser.cpp index 49fb32c8050..1a41b684949 100644 --- a/src/plugins/extensionmanager/extensionsbrowser.cpp +++ b/src/plugins/extensionmanager/extensionsbrowser.cpp @@ -329,10 +329,10 @@ public: const bool selected = option.state & QStyle::State_Selected; const bool hovered = option.state & QStyle::State_MouseOver; const QColor fillColor = - creatorTheme()->color(hovered ? WelcomePageHelpers::cardHoverBackground + creatorColor(hovered ? WelcomePageHelpers::cardHoverBackground : WelcomePageHelpers::cardDefaultBackground); const QColor strokeColor = - creatorTheme()->color(selected ? Theme::Token_Stroke_Strong + creatorColor(selected ? Theme::Token_Stroke_Strong : hovered ? WelcomePageHelpers::cardHoverStroke : WelcomePageHelpers::cardDefaultStroke); WelcomePageHelpers::drawCardBackground(painter, itemRect, fillColor, strokeColor); @@ -368,14 +368,14 @@ public: constexpr QRectF smallCircleAdjusted = smallCircle.adjusted(shrink, shrink, -shrink, -shrink); const QRectF smallCircleLocal = smallCircleAdjusted.translated(itemRect.topLeft()); - const QColor fillColor = creatorTheme()->color(Theme::Token_Foreground_Muted); - const QColor strokeColor = creatorTheme()->color(Theme::Token_Stroke_Subtle); + const QColor fillColor = creatorColor(Theme::Token_Foreground_Muted); + const QColor strokeColor = creatorColor(Theme::Token_Stroke_Subtle); painter->setBrush(fillColor); painter->setPen(strokeColor); painter->drawEllipse(smallCircleLocal); painter->setFont(StyleHelper::uiFont(StyleHelper::UiElementCaptionStrong)); - const QColor textColor = creatorTheme()->color(Theme::Token_Text_Default); + const QColor textColor = creatorColor(Theme::Token_Text_Default); painter->setPen(textColor); painter->drawText(smallCircleLocal, QString::number(data.plugins.count()), QTextOption(Qt::AlignCenter)); @@ -388,7 +388,7 @@ public: constexpr int titleY = 30; const QPointF titleOrigin(itemRect.topLeft() + QPointF(textX, titleY)); - painter->setPen(creatorTheme()->color(Theme::Token_Text_Default)); + painter->setPen(creatorColor(Theme::Token_Text_Default)); painter->setFont(StyleHelper::uiFont(StyleHelper::UiElementH6)); const QString titleElided = painter->fontMetrics().elidedText( data.name, elideMode, maxTextWidth); @@ -396,7 +396,7 @@ public: constexpr int copyrightY = 52; const QPointF copyrightOrigin(itemRect.topLeft() + QPointF(textX, copyrightY)); - painter->setPen(creatorTheme()->color(Theme::Token_Text_Muted)); + painter->setPen(creatorColor(Theme::Token_Text_Muted)); painter->setFont(StyleHelper::uiFont(StyleHelper::UiElementCaptionStrong)); const QString copyrightElided = painter->fontMetrics().elidedText( data.plugins.first()->copyright(), elideMode, maxTextWidth); @@ -405,7 +405,7 @@ public: constexpr int tagsY = 70; const QPointF tagsOrigin(itemRect.topLeft() + QPointF(textX, tagsY)); const QString tags = data.tags.join(", "); - painter->setPen(creatorTheme()->color(Theme::Token_Text_Default)); + painter->setPen(creatorColor(Theme::Token_Text_Default)); painter->setFont(StyleHelper::uiFont(StyleHelper::UiElementCaption)); const QString tagsElided = painter->fontMetrics().elidedText( tags, elideMode, maxTextWidth); diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 24daa938297..1eb8ba7d65b 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -172,18 +172,16 @@ void ChangeSelectionDialog::acceptCommand(ChangeCommand command) //! Set commit message in details void ChangeSelectionDialog::setDetails() { - Theme *theme = creatorTheme(); - QPalette palette; if (m_process->result() == ProcessResult::FinishedWithSuccess) { m_detailsText->setPlainText(m_process->cleanedStdOut()); - palette.setColor(QPalette::Text, theme->color(Theme::TextColorNormal)); + palette.setColor(QPalette::Text, creatorColor(Theme::TextColorNormal)); m_changeNumberEdit->setPalette(palette); } else if (m_process->result() == ProcessResult::StartFailed) { m_detailsText->setPlainText(Tr::tr("Error: Could not start Git.")); } else { m_detailsText->setPlainText(Tr::tr("Error: Unknown reference")); - palette.setColor(QPalette::Text, theme->color(Theme::TextColorError)); + palette.setColor(QPalette::Text, creatorColor(Theme::TextColorError)); m_changeNumberEdit->setPalette(palette); enableButtons(false); } diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp index acbf62c9ee0..1a29273d095 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.cpp +++ b/src/plugins/git/gerrit/gerritpushdialog.cpp @@ -228,7 +228,7 @@ void GerritPushDialog::setChangeRange() const int currentRange = range.toInt(); QPalette palette = QApplication::palette(); if (currentRange > ReasonableDistance) { - const QColor errorColor = Utils::creatorTheme()->color(Utils::Theme::TextColorError); + const QColor errorColor = Utils::creatorColor(Utils::Theme::TextColorError); palette.setColor(QPalette::WindowText, errorColor); palette.setColor(QPalette::ButtonText, errorColor); labelText.append("\n" + Git::Tr::tr("Are you sure you selected the right target branch?")); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c3f2e647384..5c605233594 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -3154,7 +3154,7 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr return; if (pushFailure == PushFailure::NonFastForward) { - const QColor warnColor = Utils::creatorTheme()->color(Theme::TextColorError); + const QColor warnColor = Utils::creatorColor(Theme::TextColorError); if (QMessageBox::question( Core::ICore::dialogParent(), Tr::tr("Force Push"), Tr::tr("Push failed. Would you like to force-push " diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index c9b716df269..a6635104ea7 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -120,8 +120,7 @@ void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info) { m_gitSubmitPanel->repositoryLabel->setText(info.repository.toUserOutput()); if (info.branch.contains("(no branch)")) { - const QString errorColor = - Utils::creatorTheme()->color(Utils::Theme::TextColorError).name(); + const QString errorColor = Utils::creatorColor(Utils::Theme::TextColorError).name(); m_gitSubmitPanel->branchLabel->setText(QString::fromLatin1("%2") .arg(errorColor, Tr::tr("Detached HEAD"))); } else { diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 49b4624b269..c729ff575d3 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -507,8 +507,8 @@ void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp) "%5" "") .arg(Tr::tr("No Documentation")) - .arg(creatorTheme()->color(Theme::BackgroundColorNormal).name()) - .arg(creatorTheme()->color(Theme::TextColorNormal).name()) + .arg(creatorColor(Theme::BackgroundColorNormal).name()) + .arg(creatorColor(Theme::TextColorNormal).name()) .arg(contextHelp.helpIds().join(", ")) .arg(Tr::tr("No documentation available."))); } diff --git a/src/plugins/lua/luaengine.cpp b/src/plugins/lua/luaengine.cpp index 10d75d0979a..505313da865 100644 --- a/src/plugins/lua/luaengine.cpp +++ b/src/plugins/lua/luaengine.cpp @@ -103,7 +103,7 @@ std::unique_ptr LuaEngine::runScript(const QString &script, con qDebug().noquote() << "[" << prefix << "]" << msg; if (printToOutputPane) { static const QString p - = ansiColoredText("[" + prefix + "]", creatorTheme()->color(Theme::Token_Text_Muted)); + = ansiColoredText("[" + prefix + "]", creatorColor(Theme::Token_Text_Muted)); Core::MessageManager::writeSilently(QString("%1 %2").arg(p, msg)); } }; @@ -232,7 +232,7 @@ expected_str LuaEngine::prepareSetup( qDebug().noquote() << "[" << prefix << "]" << msg; if (printToOutputPane) { static const QString p - = ansiColoredText("[" + prefix + "]", creatorTheme()->color(Theme::Token_Text_Muted)); + = ansiColoredText("[" + prefix + "]", creatorColor(Theme::Token_Text_Muted)); Core::MessageManager::writeSilently(QString("%1 %2").arg(p, msg)); } }; diff --git a/src/plugins/perfprofiler/perfprofilerflamegraphview.cpp b/src/plugins/perfprofiler/perfprofilerflamegraphview.cpp index 076c9778882..2d0c4515894 100644 --- a/src/plugins/perfprofiler/perfprofilerflamegraphview.cpp +++ b/src/plugins/perfprofiler/perfprofilerflamegraphview.cpp @@ -28,7 +28,7 @@ PerfProfilerFlameGraphView::PerfProfilerFlameGraphView(QWidget *parent) rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model); setSource(QUrl(QStringLiteral( "qrc:/qt/qml/QtCreator/PerfProfiler/PerfProfilerFlameGraphView.qml"))); - setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1)); + setClearColor(Utils::creatorColor(Utils::Theme::Timeline_BackgroundColor1)); setResizeMode(QQuickWidget::SizeRootObjectToView); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/src/plugins/perfprofiler/perftimelineresourcesrenderpass.cpp b/src/plugins/perfprofiler/perftimelineresourcesrenderpass.cpp index 8930573f328..8ccada8f4bb 100644 --- a/src/plugins/perfprofiler/perftimelineresourcesrenderpass.cpp +++ b/src/plugins/perfprofiler/perftimelineresourcesrenderpass.cpp @@ -210,7 +210,7 @@ ResourcesRenderPassState::ResourcesRenderPassState() : node = new QSGNode; node->setFlag(QSGNode::OwnedByParent, false); m_expandedRows.append(node); - m_material.setColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor)); + m_material.setColor(Utils::creatorColor(Utils::Theme::Timeline_HighlightColor)); // Disable blending m_material.setFlag(QSGMaterial::Blending, false); diff --git a/src/plugins/projectexplorer/customparserconfigdialog.cpp b/src/plugins/projectexplorer/customparserconfigdialog.cpp index cbfd1adfbc7..3793c0de6c2 100644 --- a/src/plugins/projectexplorer/customparserconfigdialog.cpp +++ b/src/plugins/projectexplorer/customparserconfigdialog.cpp @@ -406,8 +406,8 @@ bool CustomParserConfigDialog::checkPattern(QLineEdit *pattern, const QString &o QPalette palette; palette.setColor(QPalette::Text, - Utils::creatorTheme()->color(rx.isValid() ? Utils::Theme::TextColorNormal - : Utils::Theme::TextColorError)); + Utils::creatorColor(rx.isValid() ? Utils::Theme::TextColorNormal + : Utils::Theme::TextColorError)); pattern->setPalette(palette); pattern->setToolTip(rx.isValid() ? QString() : rx.errorString()); @@ -415,7 +415,7 @@ bool CustomParserConfigDialog::checkPattern(QLineEdit *pattern, const QString &o *match = rx.match(outputText); if (rx.pattern().isEmpty() || !rx.isValid() || !match->hasMatch()) { *errorMessage = QString::fromLatin1("%2 ").arg( - Utils::creatorTheme()->color(Utils::Theme::TextColorError).name(), + Utils::creatorColor(Utils::Theme::TextColorError).name(), Tr::tr("Not applicable:")); if (rx.pattern().isEmpty()) *errorMessage += Tr::tr("Pattern is empty."); diff --git a/src/plugins/projectexplorer/devicesupport/devicetestdialog.cpp b/src/plugins/projectexplorer/devicesupport/devicetestdialog.cpp index 0277fc827a0..4e522f24a0d 100644 --- a/src/plugins/projectexplorer/devicesupport/devicetestdialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicetestdialog.cpp @@ -95,10 +95,8 @@ void DeviceTestDialog::handleTestFinished(DeviceTester::TestResult result) void DeviceTestDialog::addText(const QString &text, Utils::Theme::Color color, bool bold) { - Utils::Theme *theme = Utils::creatorTheme(); - QTextCharFormat format = d->textEdit->currentCharFormat(); - format.setForeground(QBrush(theme->color(color))); + format.setForeground(QBrush(creatorColor(color))); QFont font = format.font(); font.setBold(bold); format.setFont(font); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index 55ee3790977..9c55d5345c4 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -1315,7 +1315,7 @@ JsonFieldPage::JsonFieldPage(MacroExpander *expander, QWidget *parent) : vLayout->addLayout(m_formLayout); m_errorLabel->setVisible(false); QPalette palette = m_errorLabel->palette(); - palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorError)); + palette.setColor(QPalette::WindowText, creatorColor(Theme::TextColorError)); m_errorLabel->setPalette(palette); vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding)); vLayout->addWidget(m_errorLabel); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index a9544fc8c8e..a33cd3e247e 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -434,7 +434,7 @@ void TargetSelectorDelegate::paint(QPainter *painter, painter->save(); painter->setClipping(false); - QColor textColor = creatorTheme()->color(Theme::MiniProjectTargetSelectorTextColor); + QColor textColor = creatorColor(Theme::MiniProjectTargetSelectorTextColor); if (option.state & QStyle::State_Selected) { QColor color; if (m_view->hasFocus()) { @@ -494,7 +494,7 @@ SelectorView::SelectorView(QWidget *parent) : TreeView(parent) setSelectionBehavior(SelectRows); setAttribute(Qt::WA_MacShowFocusRect, false); setHeaderHidden(true); - const QColor bgColor = creatorTheme()->color(Theme::MiniProjectTargetSelectorBackgroundColor); + const QColor bgColor = creatorColor(Theme::MiniProjectTargetSelectorBackgroundColor); const QString bgColorName = creatorTheme()->flag(Theme::FlatToolBars) ? bgColor.lighter(120).name() : bgColor.name(); setStyleSheet(QString::fromLatin1("QAbstractItemView { background: %1; border-style: none; }").arg(bgColorName)); @@ -1538,7 +1538,7 @@ void MiniProjectTargetSelector::paintEvent(QPaintEvent *) { QPainter painter(this); painter.fillRect(rect(), StyleHelper::baseColor()); - painter.setPen(creatorTheme()->color(Theme::MiniProjectTargetSelectorBorderColor)); + painter.setPen(creatorColor(Theme::MiniProjectTargetSelectorBorderColor)); // draw border on top and right QRectF borderRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5); painter.drawLine(borderRect.topLeft(), borderRect.topRight()); diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp index a60f1059475..82d391fc589 100644 --- a/src/plugins/projectexplorer/processparameters.cpp +++ b/src/plugins/projectexplorer/processparameters.cpp @@ -158,7 +158,7 @@ static QString invalidCommandMessage(const QString &displayName) return QString("%1: %2") .arg(displayName, ::Utils::Tr::tr("Invalid command"), - creatorTheme()->color(Theme::TextColorError).name()); + creatorColor(Theme::TextColorError).name()); } QString ProcessParameters::summary(const QString &displayName) const diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index c8b7392bf9c..484bc5a0192 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -242,7 +242,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const } case Qt::ForegroundRole: return node->isEnabled() ? QVariant() - : Utils::creatorTheme()->color(Utils::Theme::TextColorDisabled); + : Utils::creatorColor(Utils::Theme::TextColorDisabled); case Project::FilePathRole: return node->filePath().toString(); case Project::isParsingRole: diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index db335d1ea28..8858d2252ce 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -76,7 +76,7 @@ public: const bool useUnavailableMarker = index.data(Project::UseUnavailableMarkerRole).toBool(); if (useUnavailableMarker) { QStyleOptionViewItem opt = option; - opt.palette.setColor(QPalette::Text, creatorTheme()->color(Theme::TextColorDisabled)); + opt.palette.setColor(QPalette::Text, creatorColor(Theme::TextColorDisabled)); QStyledItemDelegate::paint(painter, opt, index); static const QPixmap pixmap = QApplication::style()->standardIcon(QStyle::SP_BrowserStop).pixmap(10); diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index d7a1fcac18e..7597f88f06e 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -219,11 +219,6 @@ void ProjectWelcomePage::createActions() /////////////////// -static QColor themeColor(Theme::Color role) -{ - return Utils::creatorTheme()->color(role); -} - static QPixmap pixmap(const QString &id, const Theme::Color color) { const QString fileName = QString(":/welcome/images/%1.png").arg(id); @@ -232,8 +227,8 @@ static QPixmap pixmap(const QString &id, const Theme::Color color) static void drawBackgroundRect(QPainter *painter, const QRectF &rect, bool hovered) { - const QColor fill(themeColor(hovered ? cardHoverBackground : cardDefaultBackground)); - const QPen pen(themeColor(hovered ? cardHoverStroke : cardDefaultStroke)); + const QColor fill(creatorColor(hovered ? cardHoverBackground : cardDefaultBackground)); + const QPen pen(creatorColor(hovered ? cardHoverStroke : cardDefaultStroke)); const qreal rounding = s(defaultCardBackgroundRounding * 1000) / 1000.0; const qreal saneRounding = rounding <= 2 ? 0 : rounding; @@ -514,7 +509,7 @@ public: .contains(mousePos) && !isDisabled; if (isActive) { WelcomePageHelpers::drawCardBackground(painter, actionR, Qt::transparent, - themeColor(Theme::Token_Text_Muted)); + creatorColor(Theme::Token_Text_Muted)); m_activeActionRects[i] = actionR; } painter->setFont(actionFont); @@ -524,7 +519,7 @@ public: xx += actionR.width(); if (i < actions.count() - 1) { const QRect dividerR(xx + s(HGapXs), yy, actionSepWidth, buttonHeight); - painter->fillRect(dividerR, themeColor(Theme::Token_Text_Muted)); + painter->fillRect(dividerR, creatorColor(Theme::Token_Text_Muted)); } xx += gapWidth; } diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 1c2f04a04c5..c3214b64984 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -1061,7 +1061,7 @@ void SelectorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti if (TreeItem *item = model->itemForIndex(index)) { switch (item->level()) { case 2: { - QColor col = creatorTheme()->color(Theme::TextColorNormal); + QColor col = creatorColor(Theme::TextColorNormal); opt.palette.setColor(QPalette::Text, col); opt.font = StyleHelper::uiFont(StyleHelper::UiElementH4); break; diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 6cf25505df5..aba55e7a6d0 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -321,7 +321,7 @@ public: case Qt::ForegroundRole: { if (!isEnabled()) - return Utils::creatorTheme()->color(Theme::TextColorDisabled); + return Utils::creatorColor(Theme::TextColorDisabled); break; } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index 02271518be9..f6bbf8d7943 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -414,7 +414,7 @@ void Edit3DWidget::showOnboardingLabel() " in the" " Assets" " view."); - text = labelText.arg(Utils::creatorTheme()->color(Utils::Theme::TextColorLink).name()); + text = labelText.arg(Utils::creatorColor(Utils::Theme::TextColorLink).name()); } else { text = tr("3D view is not supported in Qt5 projects."); } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp index 35a48a6b6dd..dd239dd9664 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp @@ -302,9 +302,9 @@ QGraphicsItem *FormEditorAnnotationIcon::createCommentBubble(QRectF rect, const const QString &author, const QString &text, const QString &date, QGraphicsItem *parent) { - static QColor textColor = Utils::creatorTheme()->color(Utils::Theme::DStextColor); - static QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColorDarker); - static QColor frameColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor); + static QColor textColor = Utils::creatorColor(Utils::Theme::DStextColor); + static QColor backgroundColor = Utils::creatorColor(Utils::Theme::QmlDesigner_BackgroundColorDarker); + static QColor frameColor = Utils::creatorColor(Utils::Theme::QmlDesigner_BackgroundColor); QFont font; font.setBold(true); @@ -405,9 +405,9 @@ QGraphicsItem *FormEditorAnnotationIcon::createCommentBubble(QRectF rect, const QGraphicsItem *FormEditorAnnotationIcon::createTitleBubble(const QRectF &rect, const QString &text, QGraphicsItem *parent) { - static QColor textColor = Utils::creatorTheme()->color(Utils::Theme::DStextColor); - static QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColorDarker); - static QColor frameColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor); + static QColor textColor = Utils::creatorColor(Utils::Theme::DStextColor); + static QColor backgroundColor = Utils::creatorColor(Utils::Theme::QmlDesigner_BackgroundColorDarker); + static QColor frameColor = Utils::creatorColor(Utils::Theme::QmlDesigner_BackgroundColor); QFont font; font.setBold(true); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 9549ce9dd46..4bd0b08c0a1 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -215,7 +215,7 @@ void FormEditorGraphicsView::drawBackground(QPainter *painter, const QRectF &rec painter->fillRect(rectangle.intersected(rootItemRect()), backgroundBrush()); } - QPen pen(Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor)); + QPen pen(Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorSelectionColor)); pen.setStyle(Qt::DotLine); pen.setWidth(1); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index 1003b53049c..b3df6b8fe72 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -305,7 +305,7 @@ void FormEditorItem::paintBoundingRect(QPainter *painter) const pen.setJoinStyle(Qt::MiterJoin); const QColor frameColor(0xaa, 0xaa, 0xaa); - static const QColor selectionColor = Utils::creatorTheme()->color( + static const QColor selectionColor = Utils::creatorColor( Utils::Theme::QmlDesigner_FormEditorSelectionColor); if (scene()->showBoundingRects()) { diff --git a/src/plugins/qmldesigner/components/formeditor/formeditortoolbutton.cpp b/src/plugins/qmldesigner/components/formeditor/formeditortoolbutton.cpp index 555d0d90e35..f3aa96ada41 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditortoolbutton.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditortoolbutton.cpp @@ -42,7 +42,7 @@ void FormEditorToolButton::paint(QPainter *painter, const QStyleOptionGraphicsIt QRectF adjustedRect(size().width() - toolButtonSize, size().height() - toolButtonSize, toolButtonSize, toolButtonSize); painter->setPen(Qt::NoPen); - static QColor selectionColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor); + static QColor selectionColor = Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorSelectionColor); if (m_state == Hovered) painter->setBrush(selectionColor.lighter(110)); diff --git a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp index 0f5b5f44385..45d26f831ea 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp @@ -78,7 +78,7 @@ void SelectionIndicator::setItems(const QList &itemList) { clear(); - static QColor selectionColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor); + static QColor selectionColor = Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorSelectionColor); for (FormEditorItem *item : itemList) { if (!item->qmlItemNode().isValid()) @@ -119,7 +119,7 @@ void SelectionIndicator::setItems(const QList &itemList) m_annotationItem = nullptr; } - static QColor textColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorForegroundColor); + static QColor textColor = Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorForegroundColor); textItem->setDefaultTextColor(textColor); QPolygonF labelPolygon = boundingRectInLayerItemSpaceForItem(selectedItem, m_layerItem.data()); diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp index 1cbced4dfac..271410233b2 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp @@ -120,7 +120,7 @@ ItemLibraryAssetImportDialog::ItemLibraryAssetImportDialog( "QPushButton#advancedSettingsButton {background-color: transparent}"); ui->advancedSettingsButton->setStyleSheet( QString("QPushButton { border: none; color :%1 }").arg( - Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_HighlightColor).name())); + Utils::creatorColor(Utils::Theme::QmlDesigner_HighlightColor).name())); QStringList importPaths; auto doc = QmlDesignerPlugin::instance()->currentDesignDocument(); diff --git a/src/plugins/qmldesigner/components/navigator/navigatorsearchwidget.cpp b/src/plugins/qmldesigner/components/navigator/navigatorsearchwidget.cpp index 24d4377ef29..e7fe0ebb775 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorsearchwidget.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorsearchwidget.cpp @@ -97,10 +97,10 @@ void LineEdit::paintEvent(QPaintEvent *event) QPalette p(palette()); p.setColor(QPalette::Active, QPalette::PlaceholderText, - Utils::creatorTheme()->color(Utils::Theme::DSplaceholderTextColor)); + Utils::creatorColor(Utils::Theme::DSplaceholderTextColor)); p.setColor(QPalette::Inactive, QPalette::PlaceholderText, - Utils::creatorTheme()->color(Utils::Theme::DSplaceholderTextColor)); + Utils::creatorColor(Utils::Theme::DSplaceholderTextColor)); setPalette(p); } QLineEdit::paintEvent(event); diff --git a/src/plugins/qmldesigner/components/navigator/previewtooltip.cpp b/src/plugins/qmldesigner/components/navigator/previewtooltip.cpp index f99b964f2d7..e5e42697e24 100644 --- a/src/plugins/qmldesigner/components/navigator/previewtooltip.cpp +++ b/src/plugins/qmldesigner/components/navigator/previewtooltip.cpp @@ -21,7 +21,8 @@ PreviewToolTip::PreviewToolTip(QWidget *parent) m_ui->idLabel->setElideMode(Qt::ElideLeft); m_ui->typeLabel->setElideMode(Qt::ElideLeft); m_ui->infoLabel->setElideMode(Qt::ElideLeft); - setStyleSheet(QString("QWidget { background-color: %1 }").arg(Utils::creatorTheme()->color(Utils::Theme::BackgroundColorNormal).name())); + setStyleSheet(QString("QWidget { background-color: %1 }") + .arg(Utils::creatorColor(Utils::Theme::BackgroundColorNormal).name())); m_ui->imageLabel->setStyleSheet("background-color: rgba(0, 0, 0, 0)"); static QPixmap checkers; diff --git a/src/plugins/qmldesigner/components/previewtooltip/previewimagetooltip.cpp b/src/plugins/qmldesigner/components/previewtooltip/previewimagetooltip.cpp index 248a9ec4292..4034254420b 100644 --- a/src/plugins/qmldesigner/components/previewtooltip/previewimagetooltip.cpp +++ b/src/plugins/qmldesigner/components/previewtooltip/previewimagetooltip.cpp @@ -20,7 +20,8 @@ PreviewImageTooltip::PreviewImageTooltip(QWidget *parent) m_ui->nameLabel->setElideMode(Qt::ElideLeft); m_ui->pathLabel->setElideMode(Qt::ElideLeft); m_ui->infoLabel->setElideMode(Qt::ElideLeft); - setStyleSheet(QString("QWidget { background-color: %1 }").arg(Utils::creatorTheme()->color(Utils::Theme::BackgroundColorNormal).name())); + setStyleSheet(QString("QWidget { background-color: %1 }") + .arg(Utils::creatorColor(Utils::Theme::BackgroundColorNormal).name())); } PreviewImageTooltip::~PreviewImageTooltip() = default; diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorstatusbar.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorstatusbar.cpp index a8981ff2f05..3f6f6769fbb 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorstatusbar.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorstatusbar.cpp @@ -15,7 +15,8 @@ TextEditorStatusBar::TextEditorStatusBar(QWidget *parent) : QToolBar(parent), m_ addWidget(m_label); /* We have to set another .css, since the central widget has already a style sheet */ - m_label->setStyleSheet(QString("QLabel { color :%1 }").arg(Utils::creatorTheme()->color(Utils::Theme::TextColorError).name())); + m_label->setStyleSheet(QString("QLabel { color :%1 }") + .arg(Utils::creatorColor(Utils::Theme::TextColorError).name())); } void TextEditorStatusBar::clearText() diff --git a/src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp b/src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp index 2861344d750..dc57cf30c89 100644 --- a/src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp +++ b/src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp @@ -42,7 +42,7 @@ QLineEdit* TextEditItemWidget::lineEdit() const m_lineEdit = std::make_unique(); m_lineEdit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); QPalette palette = m_lineEdit->palette(); - static QColor selectionColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor); + static QColor selectionColor = Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorSelectionColor); palette.setColor(QPalette::Highlight, selectionColor); palette.setColor(QPalette::HighlightedText, Qt::white); palette.setColor(QPalette::Base, Qt::white); @@ -57,7 +57,7 @@ QTextEdit* TextEditItemWidget::textEdit() const if (!m_textEdit) { m_textEdit = std::make_unique(); QPalette palette = m_textEdit->palette(); - static QColor selectionColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor); + static QColor selectionColor = Utils::creatorColor(Utils::Theme::QmlDesigner_FormEditorSelectionColor); palette.setColor(QPalette::Highlight, selectionColor); palette.setColor(QPalette::HighlightedText, Qt::white); palette.setColor(QPalette::Base, Qt::white); diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp index 591926d3f5c..592cf0dff93 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp @@ -221,10 +221,10 @@ TimelineWidget::TimelineWidget(TimelineView *view) { QPalette timelinePalette; - timelinePalette.setColor(QPalette::Text, Utils::creatorTheme()->color( + timelinePalette.setColor(QPalette::Text, Utils::creatorColor( Utils::Theme::DStextColor)); timelinePalette.setColor(QPalette::WindowText, timelinePalette.color(QPalette::Text)); - timelinePalette.setColor(QPalette::Window, Utils::creatorTheme()->color( + timelinePalette.setColor(QPalette::Window, Utils::creatorColor( Utils::Theme::QmlDesigner_BackgroundColorDarkAlternate)); onboardingTopLabel->setPalette(timelinePalette); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index c033c983316..484f18e42b6 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -1870,7 +1870,7 @@ QVariant NodeInstanceView::modelNodePreviewImageDataToVariant(const ModelNodePre placeHolder = {150, 150}; // Placeholder has transparency, but we don't want to show the checkerboard, so // paint in the correct background color - placeHolder.fill(Utils::creatorTheme()->color(Utils::Theme::BackgroundColorNormal)); + placeHolder.fill(Utils::creatorColor(Utils::Theme::BackgroundColorNormal)); QPainter painter(&placeHolder); painter.drawPixmap(0, 0, 150, 150, placeHolderSrc); } diff --git a/src/plugins/qmldesigner/documentwarningwidget.cpp b/src/plugins/qmldesigner/documentwarningwidget.cpp index e1b8346a66b..a1cc12d8254 100644 --- a/src/plugins/qmldesigner/documentwarningwidget.cpp +++ b/src/plugins/qmldesigner/documentwarningwidget.cpp @@ -149,8 +149,8 @@ bool DocumentWarningWidget::eventFilter(QObject *object, QEvent *event) void DocumentWarningWidget::showEvent(QShowEvent *event) { - const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::DScontrolBackground); - const QColor outlineColor = Utils::creatorTheme()->color(Utils::Theme::DScontrolOutline); + const QColor backgroundColor = Utils::creatorColor(Utils::Theme::DScontrolBackground); + const QColor outlineColor = Utils::creatorColor(Utils::Theme::DScontrolOutline); QPalette pal = palette(); pal.setColor(QPalette::ToolTipBase, backgroundColor); pal.setColor(QPalette::ToolTipText, outlineColor); diff --git a/src/plugins/qmldesignerbase/studio/studiostyle.cpp b/src/plugins/qmldesignerbase/studio/studiostyle.cpp index 6924e40f7cc..8bb92ccc88c 100644 --- a/src/plugins/qmldesignerbase/studio/studiostyle.cpp +++ b/src/plugins/qmldesignerbase/studio/studiostyle.cpp @@ -29,7 +29,7 @@ inline QColor studioTextColor(bool enabled, : Theme::DStextColor) : Theme::DStextColorDisabled; - return creatorTheme()->color(themePenColorId); + return creatorColor(themePenColorId); } inline QColor studioButtonBgColor(bool enabled, @@ -51,7 +51,7 @@ inline QColor studioButtonBgColor(bool enabled, ) : Theme::DScontrolBackgroundDisabled; - return creatorTheme()->color(themePenColorId); + return creatorColor(themePenColorId); } inline QColor studioButtonOutlineColor(bool enabled, @@ -67,7 +67,7 @@ inline QColor studioButtonOutlineColor(bool enabled, : Theme::DScontrolOutline) : Theme::DScontrolOutlineDisabled; - return creatorTheme()->color(themePenColorId); + return creatorColor(themePenColorId); } inline bool anyParentsFocused(const QWidget *widget) @@ -187,7 +187,7 @@ void StudioStyle::drawPrimitive( case PE_FrameMenu: case PE_PanelMenu: if (isQmlEditorMenu(widget)) - painter->fillRect(option->rect, creatorTheme()->color(Theme::DSsubPanelBackground)); + painter->fillRect(option->rect, creatorColor(Theme::DSsubPanelBackground)); else Super::drawPrimitive(element, option, painter, widget); break; @@ -241,7 +241,7 @@ void StudioStyle::drawPrimitive( } // The separator color is currently the same as toolbar bg - painter->fillRect(colorRect, creatorTheme()->color(Theme::DStoolbarBackground)); + painter->fillRect(colorRect, creatorColor(Theme::DStoolbarBackground)); } break; default: { @@ -282,7 +282,7 @@ void StudioStyle::drawControl( QStyleOptionMenuItem item = *mbi; if (isActive) { - painter->fillRect(item.rect, creatorTheme()->color(Theme::DSinteraction)); + painter->fillRect(item.rect, creatorColor(Theme::DSinteraction)); } forwardX += startMargin; @@ -294,7 +294,7 @@ void StudioStyle::drawControl( item.rect.right() - additionalMargin, commonHeight); - painter->setPen(creatorTheme()->color(Theme::DSstateSeparatorColor)); + painter->setPen(creatorColor(Theme::DSstateSeparatorColor)); painter->drawLine(separatorLine); item.text.clear(); painter->restore(); @@ -458,7 +458,7 @@ void StudioStyle::drawComplexControl( : Theme::DSpopupBackground // Idle : Theme::DSpopupBackground; // Disabled - QColor frameColor = creatorTheme()->color(themeframeColor); + QColor frameColor = creatorColor(themeframeColor); if ((option->subControls & SC_SliderGroove) && groove.isValid()) { Theme::Color themeBgPlusColor = enabled @@ -494,9 +494,9 @@ void StudioStyle::drawComplexControl( painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(creatorTheme()->color(themeBgPlusColor)); + painter->setBrush(creatorColor(themeBgPlusColor)); painter->drawRoundedRect(plusRect, borderRadius, borderRadius); - painter->setBrush(creatorTheme()->color(themeBgMinusColor)); + painter->setBrush(creatorColor(themeBgMinusColor)); painter->drawRoundedRect(minusRect, borderRadius, borderRadius); painter->restore(); } @@ -509,7 +509,7 @@ void StudioStyle::drawComplexControl( : Theme::DScontrolBackgroundDisabled; painter->setBrush(Qt::NoBrush); - painter->setPen(creatorTheme()->color(tickPen)); + painter->setPen(creatorColor(tickPen)); int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; @@ -577,7 +577,7 @@ void StudioStyle::drawComplexControl( int halfSliderThickness = horizontal ? handle.width() / 2 : handle.height() / 2; - painter->setBrush(creatorTheme()->color(handleColor)); + painter->setBrush(creatorColor(handleColor)); painter->setPen(Qt::NoPen); painter->drawRoundedRect(handle, halfSliderThickness, @@ -733,7 +733,7 @@ void StudioStyle::drawComplexControl( bool enabled = scrollBar->state & QStyle::State_Enabled; bool hovered = enabled && scrollBar->state & QStyle::State_MouseOver; - QColor buttonColor = creatorTheme()->color(hovered ? Theme::DSscrollBarHandle + QColor buttonColor = creatorColor(hovered ? Theme::DSscrollBarHandle : Theme::DSscrollBarHandle_idle); QColor gradientStartColor = buttonColor.lighter(118); QColor gradientStopColor = buttonColor; @@ -753,12 +753,12 @@ void StudioStyle::drawComplexControl( painter->save(); painter->setPen(Qt::NoPen); if (hasTransientStyle) { - QColor brushColor(creatorTheme()->color(Theme::DSscrollBarTrack)); + QColor brushColor(creatorColor(Theme::DSscrollBarTrack)); brushColor.setAlpha(0.3 * 255); painter->setBrush(QBrush(brushColor)); painter->drawRoundedRect(scrollBarGroove, 4, 4); } else { - painter->setBrush(QBrush(creatorTheme()->color(Theme::DSscrollBarTrack))); + painter->setBrush(QBrush(creatorColor(Theme::DSscrollBarTrack))); painter->drawRect(rect); } painter->restore(); diff --git a/src/plugins/qmldesignerbase/studio/studiostyle_p.cpp b/src/plugins/qmldesignerbase/studio/studiostyle_p.cpp index c1e1dece05f..adfd08c6ef5 100644 --- a/src/plugins/qmldesignerbase/studio/studiostyle_p.cpp +++ b/src/plugins/qmldesignerbase/studio/studiostyle_p.cpp @@ -31,7 +31,7 @@ inline QColor studioTextColor(bool enabled, bool active, bool checked) : Theme::DStextColor) : Theme::DStextColorDisabled; - return creatorTheme()->color(themePenColorId); + return creatorColor(themePenColorId); } }; // namespace @@ -39,7 +39,7 @@ StudioStylePrivate::StudioStylePrivate(StudioStyle *q) : QObject(q) , q(q) { - auto color = [](Theme::Color c) { return creatorTheme()->color(c); }; + auto color = [](Theme::Color c) { return creatorColor(c); }; { stdPalette.setColorGroup(QPalette::Disabled, // group diff --git a/src/plugins/qmlprofiler/flamegraphview.cpp b/src/plugins/qmlprofiler/flamegraphview.cpp index ad26f2156ad..eae418fa25e 100644 --- a/src/plugins/qmlprofiler/flamegraphview.cpp +++ b/src/plugins/qmlprofiler/flamegraphview.cpp @@ -31,7 +31,7 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model); m_content->setSource(QUrl(QStringLiteral( "qrc:/qt/qml/QtCreator/QmlProfiler/QmlProfilerFlameGraphView.qml"))); - m_content->setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1)); + m_content->setClearColor(Utils::creatorColor(Utils::Theme::Timeline_BackgroundColor1)); m_content->setResizeMode(QQuickWidget::SizeRootObjectToView); m_content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp index 0db02375ae3..7cea73b2543 100644 --- a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp @@ -285,7 +285,7 @@ BindingLoopMaterialShader::BindingLoopMaterialShader() static QColor bindingLoopsColor() { - return Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor); + return Utils::creatorColor(Utils::Theme::Timeline_HighlightColor); } bool BindingLoopMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *) diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index 4d3a73d4dc2..1d202a64a65 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -201,7 +201,7 @@ QVariant QmlProfilerStatisticsModel::dataForMainEntry(const QModelIndex &index, case TypeIdRole: return s_mainEntryTypeId; case Qt::ForegroundRole: - return Utils::creatorTheme()->color(Utils::Theme::Timeline_TextColor); + return Utils::creatorColor(Utils::Theme::Timeline_TextColor); case SortRole: switch (index.column()) { case MainTimeInPercent: @@ -279,8 +279,8 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co } case Qt::ForegroundRole: return (stats.recursive > 0 || m_notes.contains(typeIndex)) - ? Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor) - : Utils::creatorTheme()->color(Utils::Theme::Timeline_TextColor); + ? Utils::creatorColor(Utils::Theme::Timeline_HighlightColor) + : Utils::creatorColor(Utils::Theme::Timeline_TextColor); case SortRole: switch (index.column()) { case MainLocation: @@ -547,7 +547,7 @@ QVariant QmlProfilerStatisticsRelativesModel::dataForMainEntry(qint64 totalDurat case TypeIdRole: return QmlProfilerStatisticsModel::s_mainEntryTypeId; case Qt::ForegroundRole: - return Utils::creatorTheme()->color(Utils::Theme::Timeline_TextColor); + return Utils::creatorColor(Utils::Theme::Timeline_TextColor); case SortRole: if (column == RelativeTotalTime) return totalDuration; @@ -598,8 +598,8 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int return stats.isRecursive ? Tr::tr("called recursively") : QString(); case Qt::ForegroundRole: return stats.isRecursive - ? Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor) - : Utils::creatorTheme()->color(Utils::Theme::Timeline_TextColor); + ? Utils::creatorColor(Utils::Theme::Timeline_HighlightColor) + : Utils::creatorColor(Utils::Theme::Timeline_TextColor); case SortRole: switch (index.column()) { case RelativeLocation: diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index d3ade682cb2..b0da7f2b1d0 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -112,7 +112,7 @@ PublicKeyDeploymentDialog::~PublicKeyDeploymentDialog() void PublicKeyDeploymentDialog::handleDeploymentDone(bool succeeded, const QString &errorMessage) { QString buttonText = succeeded ? Tr::tr("Deployment finished successfully.") : errorMessage; - const QString textColor = creatorTheme()->color( + const QString textColor = creatorColor( succeeded ? Theme::TextColorNormal : Theme::TextColorError).name(); setLabelText(QString::fromLatin1("%2") .arg(textColor, buttonText.replace("\n", "
"))); diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index 38ee38fedf6..bfc68e89d13 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -795,7 +795,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const // File node Q_ASSERT(file); if (!file->exists()) - result = Utils::creatorTheme()->color(Utils::Theme::TextColorError); + result = Utils::creatorColor(Utils::Theme::TextColorError); } break; default: diff --git a/src/plugins/screenrecorder/screenrecorderplugin.cpp b/src/plugins/screenrecorder/screenrecorderplugin.cpp index 1aeb2ba1c44..d7f93066e69 100644 --- a/src/plugins/screenrecorder/screenrecorderplugin.cpp +++ b/src/plugins/screenrecorder/screenrecorderplugin.cpp @@ -87,7 +87,7 @@ public: }); m_spinner = new SpinnerSolution::Spinner(SpinnerSolution::SpinnerSize::Medium, this); - m_spinner->setColor(creatorTheme()->color(Theme::IconsBaseColor)); + m_spinner->setColor(creatorColor(Theme::IconsBaseColor)); m_spinner->hide(); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/src/plugins/squish/squishoutputpane.cpp b/src/plugins/squish/squishoutputpane.cpp index adb73b6b7e1..7db24f4eefa 100644 --- a/src/plugins/squish/squishoutputpane.cpp +++ b/src/plugins/squish/squishoutputpane.cpp @@ -44,8 +44,8 @@ SquishOutputPane::SquishOutputPane() m_outputWidget->setLayout(outputLayout); QPalette pal; - pal.setColor(QPalette::Window, Utils::creatorTheme()->color(Utils::Theme::InfoBarBackground)); - pal.setColor(QPalette::WindowText, Utils::creatorTheme()->color(Utils::Theme::InfoBarText)); + pal.setColor(QPalette::Window, Utils::creatorColor(Utils::Theme::InfoBarBackground)); + pal.setColor(QPalette::WindowText, Utils::creatorColor(Utils::Theme::InfoBarText)); m_summaryWidget = new QFrame; m_summaryWidget->setPalette(pal); diff --git a/src/plugins/squish/squishperspective.cpp b/src/plugins/squish/squishperspective.cpp index 1b762c71a41..4eb63cbb7eb 100644 --- a/src/plugins/squish/squishperspective.cpp +++ b/src/plugins/squish/squishperspective.cpp @@ -57,9 +57,9 @@ static QIcon iconForType(IconType type) static QString customStyleSheet(bool extended) { - static const QString red = Utils::creatorTheme()->color( + static const QString red = Utils::creatorColor( Utils::Theme::ProgressBarColorError).name(); - static const QString green = Utils::creatorTheme()->color( + static const QString green = Utils::creatorColor( Utils::Theme::ProgressBarColorFinished).name(); if (!extended) return "QProgressBar {text-align:left; border:0px}"; diff --git a/src/plugins/squish/testresult.cpp b/src/plugins/squish/testresult.cpp index 7e229d50e05..38b9ca1d9a3 100644 --- a/src/plugins/squish/testresult.cpp +++ b/src/plugins/squish/testresult.cpp @@ -46,29 +46,27 @@ QString TestResult::typeToString(Result::Type type) QColor TestResult::colorForType(Result::Type type) { - Utils::Theme *creatorTheme = Utils::creatorTheme(); - switch (type) { case Result::Start: case Result::Log: case Result::Detail: case Result::End: - return creatorTheme->color(Utils::Theme::OutputPanes_StdOutTextColor); + return creatorColor(Utils::Theme::OutputPanes_StdOutTextColor); case Result::Pass: - return creatorTheme->color(Utils::Theme::OutputPanes_TestPassTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestPassTextColor); case Result::Fail: case Result::Error: - return creatorTheme->color(Utils::Theme::OutputPanes_TestFailTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestFailTextColor); case Result::ExpectedFail: - return creatorTheme->color(Utils::Theme::OutputPanes_TestXFailTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestXFailTextColor); case Result::UnexpectedPass: - return creatorTheme->color(Utils::Theme::OutputPanes_TestXPassTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestXPassTextColor); case Result::Warn: - return creatorTheme->color(Utils::Theme::OutputPanes_TestWarnTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestWarnTextColor); case Result::Fatal: - return creatorTheme->color(Utils::Theme::OutputPanes_TestFatalTextColor); + return creatorColor(Utils::Theme::OutputPanes_TestFatalTextColor); } - return creatorTheme->color(Utils::Theme::OutputPanes_StdOutTextColor); + return creatorColor(Utils::Theme::OutputPanes_StdOutTextColor); } } // namespace Internal diff --git a/src/plugins/terminal/terminalsettings.cpp b/src/plugins/terminal/terminalsettings.cpp index 62e0c209c12..4e754dc7dd1 100644 --- a/src/plugins/terminal/terminalsettings.cpp +++ b/src/plugins/terminal/terminalsettings.cpp @@ -527,37 +527,35 @@ TerminalSettings::TerminalSettings() enableMouseTracking.setToolTip(Tr::tr("Enables mouse tracking in the terminal.")); enableMouseTracking.setDefaultValue(true); - Theme *theme = Utils::creatorTheme(); + setupColor(this, foregroundColor, "Foreground", creatorColor(Theme::TerminalForeground)); + setupColor(this, backgroundColor, "Background", creatorColor(Theme::TerminalBackground)); + setupColor(this, selectionColor, "Selection", creatorColor(Theme::TerminalSelection)); - setupColor(this, foregroundColor, "Foreground", theme->color(Theme::TerminalForeground)); - setupColor(this, backgroundColor, "Background", theme->color(Theme::TerminalBackground)); - setupColor(this, selectionColor, "Selection", theme->color(Theme::TerminalSelection)); + setupColor(this, findMatchColor, "Find matches", creatorColor(Theme::TerminalFindMatch)); - setupColor(this, findMatchColor, "Find matches", theme->color(Theme::TerminalFindMatch)); + setupColor(this, colors[0], "0", creatorColor(Theme::TerminalAnsi0), "black"); + setupColor(this, colors[8], "8", creatorColor(Theme::TerminalAnsi8), "bright black"); - setupColor(this, colors[0], "0", theme->color(Theme::TerminalAnsi0), "black"); - setupColor(this, colors[8], "8", theme->color(Theme::TerminalAnsi8), "bright black"); + setupColor(this, colors[1], "1", creatorColor(Theme::TerminalAnsi1), "red"); + setupColor(this, colors[9], "9", creatorColor(Theme::TerminalAnsi9), "bright red"); - setupColor(this, colors[1], "1", theme->color(Theme::TerminalAnsi1), "red"); - setupColor(this, colors[9], "9", theme->color(Theme::TerminalAnsi9), "bright red"); + setupColor(this, colors[2], "2", creatorColor(Theme::TerminalAnsi2), "green"); + setupColor(this, colors[10], "10", creatorColor(Theme::TerminalAnsi10), "bright green"); - setupColor(this, colors[2], "2", theme->color(Theme::TerminalAnsi2), "green"); - setupColor(this, colors[10], "10", theme->color(Theme::TerminalAnsi10), "bright green"); + setupColor(this, colors[3], "3", creatorColor(Theme::TerminalAnsi3), "yellow"); + setupColor(this, colors[11], "11", creatorColor(Theme::TerminalAnsi11), "bright yellow"); - setupColor(this, colors[3], "3", theme->color(Theme::TerminalAnsi3), "yellow"); - setupColor(this, colors[11], "11", theme->color(Theme::TerminalAnsi11), "bright yellow"); + setupColor(this, colors[4], "4", creatorColor(Theme::TerminalAnsi4), "blue"); + setupColor(this, colors[12], "12", creatorColor(Theme::TerminalAnsi12), "bright blue"); - setupColor(this, colors[4], "4", theme->color(Theme::TerminalAnsi4), "blue"); - setupColor(this, colors[12], "12", theme->color(Theme::TerminalAnsi12), "bright blue"); + setupColor(this, colors[5], "5", creatorColor(Theme::TerminalAnsi5), "magenta"); + setupColor(this, colors[13], "13", creatorColor(Theme::TerminalAnsi13), "bright magenta"); - setupColor(this, colors[5], "5", theme->color(Theme::TerminalAnsi5), "magenta"); - setupColor(this, colors[13], "13", theme->color(Theme::TerminalAnsi13), "bright magenta"); + setupColor(this, colors[6], "6", creatorColor(Theme::TerminalAnsi6), "cyan"); + setupColor(this, colors[14], "14", creatorColor(Theme::TerminalAnsi14), "bright cyan"); - setupColor(this, colors[6], "6", theme->color(Theme::TerminalAnsi6), "cyan"); - setupColor(this, colors[14], "14", theme->color(Theme::TerminalAnsi14), "bright cyan"); - - setupColor(this, colors[7], "7", theme->color(Theme::TerminalAnsi7), "white"); - setupColor(this, colors[15], "15", theme->color(Theme::TerminalAnsi15), "bright white"); + setupColor(this, colors[7], "7", creatorColor(Theme::TerminalAnsi7), "white"); + setupColor(this, colors[15], "15", creatorColor(Theme::TerminalAnsi15), "bright white"); setLayouter([this] { using namespace Layouting; diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index 1739cf61b9e..459d0ca27c1 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -371,7 +371,7 @@ bool TextMark::addToolTipContent(QLayout *target) const QColor TextMark::annotationColor() const { if (m_color.has_value()) - return Utils::creatorTheme()->color(*m_color).toHsl(); + return Utils::creatorColor(*m_color).toHsl(); return {}; } diff --git a/src/plugins/todo/keyword.cpp b/src/plugins/todo/keyword.cpp index 8a505b1239b..a178bb92e1d 100644 --- a/src/plugins/todo/keyword.cpp +++ b/src/plugins/todo/keyword.cpp @@ -8,7 +8,7 @@ namespace Todo { namespace Internal { -Keyword::Keyword() : color(Utils::creatorTheme()->color(Utils::Theme::TextColorNormal)) +Keyword::Keyword() : color(Utils::creatorColor(Utils::Theme::TextColorNormal)) { } diff --git a/src/plugins/todo/settings.cpp b/src/plugins/todo/settings.cpp index 71c2a1b69e9..dc534f98c88 100644 --- a/src/plugins/todo/settings.cpp +++ b/src/plugins/todo/settings.cpp @@ -99,7 +99,6 @@ void Settings::load() void Settings::setDefault() { scanningScope = ScanningScopeCurrentFile; - Utils::Theme *theme = Utils::creatorTheme(); keywords.clear(); @@ -107,32 +106,32 @@ void Settings::setDefault() keyword.name = "TODO"; keyword.iconType = IconType::Todo; - keyword.color = theme->color(Utils::Theme::OutputPanes_NormalMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_NormalMessageTextColor); keywords.append(keyword); keyword.name = R"(\todo)"; keyword.iconType = IconType::Todo; - keyword.color = theme->color(Utils::Theme::OutputPanes_NormalMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_NormalMessageTextColor); keywords.append(keyword); keyword.name = "NOTE"; keyword.iconType = IconType::Info; - keyword.color = theme->color(Utils::Theme::OutputPanes_NormalMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_NormalMessageTextColor); keywords.append(keyword); keyword.name = "FIXME"; keyword.iconType = IconType::Error; - keyword.color = theme->color(Utils::Theme::OutputPanes_ErrorMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_ErrorMessageTextColor); keywords.append(keyword); keyword.name = "BUG"; keyword.iconType = IconType::Bug; - keyword.color = theme->color(Utils::Theme::OutputPanes_ErrorMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_ErrorMessageTextColor); keywords.append(keyword); keyword.name = "WARNING"; keyword.iconType = IconType::Warning; - keyword.color = theme->color(Utils::Theme::OutputPanes_WarningMessageTextColor); + keyword.color = creatorColor(Utils::Theme::OutputPanes_WarningMessageTextColor); keywords.append(keyword); keywordsEdited = false; diff --git a/src/plugins/vcsbase/submiteditorwidget.cpp b/src/plugins/vcsbase/submiteditorwidget.cpp index b8f3d2a151d..73d83586568 100644 --- a/src/plugins/vcsbase/submiteditorwidget.cpp +++ b/src/plugins/vcsbase/submiteditorwidget.cpp @@ -585,8 +585,7 @@ void SubmitEditorWidget::verifyDescription() } auto fontColor = [](Utils::Theme::Color color) { - return QString("") - .arg(Utils::creatorTheme()->color(color).name()); + return QString("").arg(Utils::creatorColor(color).name()); }; const QString hint = fontColor(Utils::Theme::OutputPanes_TestWarnTextColor); const QString warning = fontColor(Utils::Theme::TextColorError); diff --git a/src/plugins/vcsbase/submitfilemodel.cpp b/src/plugins/vcsbase/submitfilemodel.cpp index 02a9b6e359e..a07538076da 100644 --- a/src/plugins/vcsbase/submitfilemodel.cpp +++ b/src/plugins/vcsbase/submitfilemodel.cpp @@ -45,7 +45,7 @@ static QBrush fileStatusTextForeground(SubmitFileModel::FileStatusHint statusHin statusTextColor = Theme::VcsBase_FileUnmerged_TextColor; break; } - return QBrush(Utils::creatorTheme()->color(statusTextColor)); + return QBrush(Utils::creatorColor(statusTextColor)); } static QList createFileRow(const FilePath &repositoryRoot, diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 5105be5430c..7efdd7d20f5 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -435,7 +435,7 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor) void UrlTextCursorHandler::highlightCurrentContents() { - const QColor linkColor = creatorTheme()->color(Theme::TextColorLink); + const QColor linkColor = creatorColor(Theme::TextColorLink); QTextEdit::ExtraSelection sel; sel.cursor = currentCursor(); sel.cursor.setPosition(currentCursor().position() diff --git a/src/plugins/vcsbase/wizard/vcscommandpage.cpp b/src/plugins/vcsbase/wizard/vcscommandpage.cpp index ab594526887..caabb20cf29 100644 --- a/src/plugins/vcsbase/wizard/vcscommandpage.cpp +++ b/src/plugins/vcsbase/wizard/vcscommandpage.cpp @@ -383,11 +383,11 @@ void VcsCommandPage::finished(bool success) if (success) { m_state = Succeeded; message = Tr::tr("Succeeded."); - palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorNormal).name()); + palette.setColor(QPalette::WindowText, creatorColor(Theme::TextColorNormal).name()); } else { m_state = Failed; message = Tr::tr("Failed."); - palette.setColor(QPalette::WindowText, creatorTheme()->color(Theme::TextColorError).name()); + palette.setColor(QPalette::WindowText, creatorColor(Theme::TextColorError).name()); } m_statusLabel->setText(message);