+ improve handling of default colors of report view and Python console when using style sheets

This commit is contained in:
wmayer
2014-01-31 11:34:30 +01:00
parent 7b4776684a
commit 4547996201
5 changed files with 28 additions and 19 deletions

View File

@@ -121,7 +121,8 @@ struct TextBlockData : public QTextBlockUserData
ReportHighlighter::ReportHighlighter(QTextEdit* edit)
: QSyntaxHighlighter(edit), type(Message)
{
txtCol = Qt::black;
QPalette pal = edit->palette();
txtCol = pal.windowText().color();
logCol = Qt::blue;
warnCol = QColor(255, 170, 0);
errCol = Qt::red;
@@ -372,6 +373,19 @@ void ReportOutput::customEvent ( QEvent* ev )
}
}
void ReportOutput::changeEvent(QEvent *ev)
{
if (ev->type() == QEvent::StyleChange) {
QPalette pal = palette();
QColor color = pal.windowText().color();
unsigned long text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
// if this parameter is not already set use the style's window text color
text = getWindowParameter()->GetUnsigned("colorText", text);
getWindowParameter()->SetUnsigned("colorText", text);
}
QTextEdit::changeEvent(ev);
}
void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
{
QMenu* menu = createStandardContextMenu();