aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/fontsettingspage.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2016-07-24 09:42:35 +0300
committerOrgad Shaneh <orgads@gmail.com>2016-07-28 13:21:49 +0000
commitf398e7d22ac710dd8ed7bc110b56424e4e3c6b2f (patch)
tree6f8537299f2f6bed57d78490cc8372a826a11b2b /src/plugins/texteditor/fontsettingspage.cpp
parent589aef89e0c98849dda2356f5982644a779abe8f (diff)
TextEditor: Use initial palette for default colors
The theme might be incompatible with the text style settings, especially those that rely on the default palette (and were designed before themes were implemented). Task-number: QTCREATORBUG-16482 Change-Id: I8f63460ad250a494dcafd11366d7bacdbb71c142 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/texteditor/fontsettingspage.cpp')
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 97865a404ae..7357510abda 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -253,15 +253,17 @@ FormatDescription::FormatDescription(TextStyle id,
QColor FormatDescription::defaultForeground(TextStyle id)
{
if (id == C_LINE_NUMBER) {
- const QColor bg = QApplication::palette().background().color();
+ const QPalette palette = Utils::Theme::initialPalette();
+ const QColor bg = palette.background().color();
if (bg.value() < 128)
- return QApplication::palette().foreground().color();
+ return palette.foreground().color();
else
- return QApplication::palette().dark().color();
+ return palette.dark().color();
} else if (id == C_CURRENT_LINE_NUMBER) {
- const QColor bg = QApplication::palette().background().color();
+ const QPalette palette = Utils::Theme::initialPalette();
+ const QColor bg = palette.background().color();
if (bg.value() < 128)
- return QApplication::palette().foreground().color();
+ return palette.foreground().color();
else
return QColor();
} else if (id == C_PARENTHESES) {
@@ -277,7 +279,7 @@ QColor FormatDescription::defaultBackground(TextStyle id)
if (id == C_TEXT) {
return Qt::white;
} else if (id == C_LINE_NUMBER) {
- return QApplication::palette().background().color();
+ return Utils::Theme::initialPalette().background().color();
} else if (id == C_SEARCH_RESULT) {
return QColor(0xffef0b);
} else if (id == C_PARENTHESES) {
@@ -287,7 +289,7 @@ QColor FormatDescription::defaultBackground(TextStyle id)
} else if (id == C_AUTOCOMPLETE) {
return QColor(192, 192, 255);
} else if (id == C_CURRENT_LINE || id == C_SEARCH_SCOPE) {
- const QPalette palette = QApplication::palette();
+ const QPalette palette = Utils::Theme::initialPalette();
const QColor &fg = palette.color(QPalette::Highlight);
const QColor &bg = palette.color(QPalette::Base);
@@ -308,8 +310,7 @@ QColor FormatDescription::defaultBackground(TextStyle id)
fg.blueF() * ratio + bg.blueF() * (1 - ratio));
return col;
} else if (id == C_SELECTION) {
- const QPalette palette = QApplication::palette();
- return palette.color(QPalette::Highlight);
+ return Utils::Theme::initialPalette().color(QPalette::Highlight);
} else if (id == C_OCCURRENCES) {
return QColor(180, 180, 180);
} else if (id == C_OCCURRENCES_RENAME) {