Mercurial > hg > octave-nkf
changeset 16474:720fd1ca04ec
another attempt to fix windows command window colors
* QWinTerminalImpl.cpp (QConsolePrivate::m_foregoundColor):
New member variable.
(QConsolePrivate::QConsolePrivate): Set it to Qt::black.
Call SetConsoleTextAttribute to set console foreground and background
colors.
(QWinTerminalImpl::viewPaintEvent): Set pen color to
m_foregroundColor.
Set pen and brush color from current terminal attributes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 09 Apr 2013 02:34:02 -0400 |
parents | e16f209ed05b |
children | 0696dcc92fc8 |
files | libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp +++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp @@ -116,6 +116,7 @@ private: QFont m_font; QColor m_backgroundColor; + QColor m_foregroundColor; QString m_command; QConsoleColors m_colors; bool m_inWheelEvent; @@ -224,10 +225,13 @@ GetConsoleTitleW (titleBuf, sizeof (titleBuf)); q->setWindowTitle (QString::fromWCharArray (titleBuf)); + m_backgroundColor = Qt::white; + m_foregroundColor = Qt::black; + SetConsoleTextAttribute (m_stdOut, 0x0F); + m_font.setFamily ("Lucida Console"); m_font.setPointSize (9); m_font.setStyleHint (QFont::TypeWriter); - m_backgroundColor = Qt::white; m_buffer = m_tmpBuffer = 0; @@ -748,7 +752,7 @@ return; p.setFont (d->m_font); - p.setPen (Qt::black); + p.setPen (d->m_foregroundColor); ascent = p.fontMetrics ().ascent (); stride = d->m_consoleRect.width (); @@ -787,8 +791,8 @@ // Update current pen and store current attributes // FIXME: what about background? attr = (ci->Attributes & 0x00ff); - p.setPen (Qt::black); - p.setBrush (Qt::black); + p.setPen (d->m_colors[attr & 0x000f]); + p.setBrush (d->m_colors[(attr >> 4) & 0x000f]); } // Append current character to the string buffer