diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index a2009c646..067c69b3a 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -28,10 +28,11 @@ #include #include -Text::Text(const QString& txt, QFont font, bool enableElide, const QString &rwText) +Text::Text(const QString& txt, QFont font, bool enableElide, const QString &rwText, const QColor c) : rawText(rwText) , elide(enableElide) , defFont(font) + , color(c) { setText(txt); setAcceptedMouseButtons(Qt::LeftButton); @@ -171,6 +172,7 @@ void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWid sel.format.setBackground(selectionColor.lighter(selectionHasFocus ? 100 : 160)); sel.format.setForeground(selectionHasFocus ? Qt::white : Qt::black); ctx.selections.append(sel); + ctx.palette.setColor(QPalette::Text, color); // draw text doc->documentLayout()->draw(painter, ctx); diff --git a/src/chatlog/content/text.h b/src/chatlog/content/text.h index 4fe23ad92..292d2396d 100644 --- a/src/chatlog/content/text.h +++ b/src/chatlog/content/text.h @@ -28,7 +28,7 @@ class Text : public ChatLineContent public: // txt: may contain html code // rawText: does not contain html code - Text(const QString& txt = "", QFont font = QFont(), bool enableElide = false, const QString& rawText = QString()); + Text(const QString& txt = "", QFont font = QFont(), bool enableElide = false, const QString& rawText = QString(), const QColor c = Qt::black); virtual ~Text(); void setText(const QString& txt); @@ -83,6 +83,7 @@ private: qreal ascent = 0.0; qreal width = 0.0; QFont defFont; + QColor color; };