forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Alessandro Portale
parent
150d53e041
commit
95e0418e8e
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user