diff options
author | Aaron Barany <akb825@gmail.com> | 2018-04-26 01:34:33 -0700 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2018-05-25 14:03:50 +0000 |
commit | 95e0418e8e29abee3f02bdb87ad2a40eb8aaf9fe (patch) | |
tree | b8efe71fb50a83112fb11b6dc627f3090079c817 | |
parent | 150d53e04139879ecea88d39cfa3a88eaf4da5f4 (diff) | |
download | qt-creator-95e0418e8e29abee3f02bdb87ad2a40eb8aaf9fe.tar.gz |
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 <alessandro.portale@qt.io>
-rw-r--r-- | src/plugins/projectexplorer/miniprojecttargetselector.cpp | 14 | ||||
-rw-r--r-- | 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<QAbstractItemModel *>(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); |