From 95e0418e8e29abee3f02bdb87ad2a40eb8aaf9fe Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Thu, 26 Apr 2018 01:34:33 -0700 Subject: Editor: Improve visibility of some UI elements Don't set the initial palette on the text color scheme dialog. For dark themes this would cause the labels for the dialog to be black, which was very difficult to read against the dark background. Mini project selector now uses the highlighted text color for the item that has focus. This will work more correctly when dark themes use a more readable selection color, which will be done next commit. Task-number: QTCREATORBUG-18888 Change-Id: Ie666af0ce9f8a8030e5e83ccd9a4de362dccaa4f Reviewed-by: Alessandro Portale --- src/plugins/projectexplorer/miniprojecttargetselector.cpp | 14 ++++++++++---- src/plugins/texteditor/colorschemeedit.cpp | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index f3abfffcdb..438fed2834 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -128,10 +128,16 @@ void TargetSelectorDelegate::paint(QPainter *painter, painter->save(); painter->setClipping(false); + QColor textColor = creatorTheme()->color(Theme::MiniProjectTargetSelectorTextColor); if (option.state & QStyle::State_Selected) { - const QColor color = (option.state & QStyle::State_HasFocus) ? - option.palette.highlight().color() : - option.palette.dark().color(); + QColor color; + if (option.state & QStyle::State_HasFocus) { + color = option.palette.highlight().color(); + textColor = option.palette.highlightedText().color(); + } else { + color = option.palette.dark().color(); + } + if (creatorTheme()->flag(Theme::FlatToolBars)) { painter->fillRect(option.rect, color); } else { @@ -150,7 +156,7 @@ void TargetSelectorDelegate::paint(QPainter *painter, QFontMetrics fm(option.font); QString text = index.data(Qt::DisplayRole).toString(); - painter->setPen(creatorTheme()->color(Theme::MiniProjectTargetSelectorTextColor)); + painter->setPen(textColor); QString elidedText = fm.elidedText(text, Qt::ElideMiddle, option.rect.width() - 12); if (elidedText != text) const_cast(index.model())->setData(index, text, Qt::ToolTipRole); diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 74855b95d3..d0c615406d 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -153,7 +153,6 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : m_formatsModel(new FormatsModel(this)) { setContentsMargins(0, layoutSpacing, 0, 0); - setPalette(Utils::Theme::initialPalette()); m_ui->setupUi(this); m_ui->itemList->setModel(m_formatsModel); -- cgit v1.2.1