From c04ece53081d06fd0e071155ca6d47b66e74aac3 Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Wed, 16 Dec 2009 12:15:51 +0100 Subject: [PATCH] Nicer graying out of old content in the output window Experiment with changing the foreground rather than the background. Done with: thorbjorn --- src/plugins/projectexplorer/outputwindow.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index b17e96b323c..69567498c57 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -465,18 +465,23 @@ void OutputWindow::insertLine() void OutputWindow::grayOutOldContent() { QTextCursor cursor = textCursor(); + cursor.movePosition(QTextCursor::End); + QTextCharFormat endFormat = cursor.charFormat(); + cursor.select(QTextCursor::Document); - QTextBlockFormat tbf; + + QTextCharFormat format; const QColor bkgColor = palette().base().color(); const QColor fgdColor = palette().text().color(); - double bkgFactor = 0.85; + double bkgFactor = 0.50; double fgdFactor = 1.-bkgFactor; - tbf.setBackground(QColor((bkgFactor * bkgColor.red() + fgdFactor * fgdColor.red()), + format.setForeground(QColor((bkgFactor * bkgColor.red() + fgdFactor * fgdColor.red()), (bkgFactor * bkgColor.green() + fgdFactor * fgdColor.green()), (bkgFactor * bkgColor.blue() + fgdFactor * fgdColor.blue()) )); - cursor.mergeBlockFormat(tbf); + cursor.mergeCharFormat(format); cursor.movePosition(QTextCursor::End); + cursor.setCharFormat(endFormat); cursor.insertBlock(QTextBlockFormat()); } -- GitLab