void ChatLine::setGeometryByWidth(const qreal &width, const qreal &contentsWidth, qreal &linePos) {
qreal height = _contentsItem.setGeometryByWidth(contentsWidth);
linePos -= height;
- bool needGeometryChange = linePos == pos().y();
+ bool needGeometryChange = (height != _height || width != _width);
- if(needGeometryChange) {
+ if(height != _height) {
_timestampItem.prepareGeometryChange();
+ _timestampItem.setHeight(height);
_senderItem.prepareGeometryChange();
+ _senderItem.setHeight(height);
}
- _timestampItem.setHeight(height);
- _senderItem.setHeight(height);
- if(needGeometryChange)
+ if(needGeometryChange) {
prepareGeometryChange();
-
- _height = height;
- _width = width;
+ _height = height;
+ _width = width;
+ }
setPos(0, linePos); // set pos is _very_ cheap if nothing changes.
}
BufferId bufferId = BufferId(chatScene()->idString().toInt());
MsgId lastSeenMsgId = Client::networkModel()->lastSeenMarkerMsgId(bufferId);
if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) {
- QtUiStyleSettings s("Colors");
QLinearGradient gradient(0, 0, 0, contentsItem().fontMetrics()->lineSpacing());
- gradient.setColorAt(0, s.value("newMsgMarkerFG", QColor(Qt::red)).value<QColor>());
+ gradient.setColorAt(0, QtUi::style()->brush(UiStyle::MarkerLine).color()); // FIXME: Use full (gradient?) brush instead of just the color
gradient.setColorAt(0.1, Qt::transparent);
painter->fillRect(boundingRect(), gradient);
}