From d5ec641f9e074db828b9b7008b368a3aa332e545 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 16 May 2017 19:45:27 +0200 Subject: [PATCH] changing background color as a function of commenter ID (needs to be further adapted to all styles) --- retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index f8fcdbdd4..c9e930725 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -96,11 +96,10 @@ public: p.setRenderHint(QPainter::Antialiasing); QPainterPath path ; - //path.addRoundedRect(QRectF(m/4.0f,m/4.0f,s.width()+m/2.0,s.height()+m/2.0),m,m) ; path.addRoundedRect(QRectF(m/7.0,m/7.0,s.width()+m/2.0,s.height()+m/2.0),m,m) ; QPen pen(Qt::gray,m/7.0f); p.setPen(pen); - p.fillPath(path,QColor::fromRgb(250,230,200)); // Would be nice to vary the color according to the post author + p.fillPath(path,QColor::fromHsv( index.data(Qt::UserRole+2).toInt()/255.0*360,40,200)); // Would be nice to vary the color according to the post author p.drawPath(path); QAbstractTextDocumentLayout::PaintContext ctx; @@ -509,6 +508,7 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token) RsGxsId authorId = comment.mMeta.mAuthorId; item->setId(authorId, PCITEM_COLUMN_AUTHOR, false); + item->setData(PCITEM_COLUMN_COMMENT,Qt::UserRole+2,QVariant(authorId.toByteArray()[1])); text = QString::number(comment.mScore); item->setText(PCITEM_COLUMN_SCORE, text);