Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
bf3a9e4e
Commit
bf3a9e4e
authored
Jul 14, 2010
by
dt
Browse files
Fix colors in Application Output for dark themes
parent
614cd408
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/outputformatter.cpp
View file @
bf3a9e4e
...
...
@@ -41,7 +41,7 @@ OutputFormatter::OutputFormatter()
:
QObject
()
,
m_formats
(
0
)
{
initFormats
();
}
OutputFormatter
::~
OutputFormatter
()
...
...
@@ -58,6 +58,7 @@ QPlainTextEdit *OutputFormatter::plainTextEdit() const
void
OutputFormatter
::
setPlainTextEdit
(
QPlainTextEdit
*
plainText
)
{
m_plainTextEdit
=
plainText
;
initFormats
();
}
void
OutputFormatter
::
appendApplicationOutput
(
const
QString
&
text
,
bool
onStdErr
)
...
...
@@ -82,8 +83,16 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
cursor
.
insertText
(
text
,
format
);
}
static
QColor
mix_colors
(
QColor
a
,
QColor
b
)
{
return
QColor
((
a
.
red
()
+
b
.
red
())
/
2
,
(
a
.
green
()
+
b
.
green
())
/
2
,
(
a
.
blue
()
+
b
.
blue
())
/
2
,
(
a
.
alpha
()
+
b
.
alpha
())
/
2
);
}
void
OutputFormatter
::
initFormats
()
{
QPalette
p
=
plainTextEdit
()
->
palette
();
FontSettings
fs
=
TextEditorSettings
::
instance
()
->
fontSettings
();
QFont
font
=
fs
.
font
();
QFont
boldFont
=
font
;
...
...
@@ -93,19 +102,19 @@ void OutputFormatter::initFormats()
// NormalMessageFormat
m_formats
[
NormalMessageFormat
].
setFont
(
boldFont
);
m_formats
[
NormalMessageFormat
].
setForeground
(
QColor
(
Qt
::
blue
));
m_formats
[
NormalMessageFormat
].
setForeground
(
mix_colors
(
QColor
(
Qt
::
blue
)
,
p
.
color
(
QPalette
::
Text
))
);
// ErrorMessageFormat
m_formats
[
ErrorMessageFormat
].
setFont
(
boldFont
);
m_formats
[
ErrorMessageFormat
].
setForeground
(
QColor
(
200
,
0
,
0
));
m_formats
[
ErrorMessageFormat
].
setForeground
(
mix_colors
(
QColor
(
Qt
::
red
),
p
.
color
(
QPalette
::
Text
)
));
// StdOutFormat
m_formats
[
StdOutFormat
].
setFont
(
font
);
m_formats
[
StdOutFormat
].
setForeground
(
QC
olor
(
Q
t
::
black
));
m_formats
[
StdOutFormat
].
setForeground
(
p
.
c
olor
(
Q
Palette
::
Text
));
// StdErrFormat
m_formats
[
StdErrFormat
].
setFont
(
font
);
m_formats
[
StdErrFormat
].
setForeground
(
QColor
(
200
,
0
,
0
));
m_formats
[
StdErrFormat
].
setForeground
(
mix_colors
(
QColor
(
Qt
::
red
),
p
.
color
(
QPalette
::
Text
)
));
}
void
OutputFormatter
::
handleLink
(
const
QString
&
href
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment