From d33a73406dc7b2a41c97d169b865836f6fce4980 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 30 Jul 2009 00:52:21 +0200 Subject: [PATCH 1/1] Merge all stylesheet formats with the base format --- src/uisupport/uistyle.cpp | 10 ++++++++-- src/uisupport/uistyle.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 6cfff50a..1a478f28 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -38,7 +38,7 @@ UiStyle::UiStyle(QObject *parent) : QObject(parent) { } // Now initialize the mapping between FormatCodes and FormatTypes... - _formatCodes["%O"] = None; + _formatCodes["%O"] = Base; _formatCodes["%B"] = Bold; _formatCodes["%S"] = Italic; _formatCodes["%U"] = Underline; @@ -81,7 +81,13 @@ void UiStyle::loadStyleSheet() { QssParser parser; parser.processStyleSheet(styleSheet); QApplication::setPalette(parser.palette()); - _formatCache = parser.formats(); + + QTextCharFormat baseFmt = parser.formats().value(Base); + foreach(quint64 fmtType, parser.formats().keys()) { + QTextCharFormat fmt = baseFmt; + fmt.merge(parser.formats().value(fmtType)); + _formatCache[fmtType] = fmt; + } qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application } diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index 7e4094f8..843d2f22 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -49,7 +49,7 @@ public: * Also, we _do_ rely on certain properties of these values in styleString() and friends! */ enum FormatType { - None = 0x00000000, + Base = 0x00000000, Invalid = 0xffffffff, // Message Formats (mutually exclusive!) @@ -105,7 +105,7 @@ public: class StyledMessage; static FormatType formatType(Message::Type msgType); - static StyledString styleString(const QString &string, quint32 baseFormat = None); + static StyledString styleString(const QString &string, quint32 baseFormat = Base); static QString mircToInternal(const QString &); static inline QString timestampFormatString() { return _timestampFormatString; } -- 2.20.1