X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=f0772b315e126eb79bd9d61d52b9d16ede4ea2b4;hb=2ab3040da0e42f4afdd282e34f0d8b089020a73d;hp=db4149a2792cdd8511c9eabac565006eed15db03;hpb=c74675fde7e2082dce1a6e4c4281308b946c49d9;p=quassel.git diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index db4149a2..f0772b31 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -51,6 +51,7 @@ ChatLine::ChatLine(int row, QAbstractItemModel *model, { Q_ASSERT(model); QModelIndex index = model->index(row, ChatLineModel::ContentsColumn); + setZValue(0); setHighlighted(model->data(index, MessageModel::FlagsRole).toInt() & Message::Highlight); } @@ -74,9 +75,10 @@ ChatItem &ChatLine::item(ChatLineModel::ColumnType column) { // NOTE: senderPos and contentsPos are in ChatLines coordinate system! qreal ChatLine::setColumns(const qreal ×tampWidth, const qreal &senderWidth, const qreal &contentsWidth, const QPointF &senderPos, const QPointF &contentsPos) { - _height = _contentsItem.setGeometryByWidth(contentsWidth); - _senderItem.setGeometry(senderWidth, _height); - _timestampItem.setGeometry(timestampWidth, _height); + prepareGeometryChange(); + qreal height = _contentsItem.setGeometryByWidth(contentsWidth); + _senderItem.setGeometry(senderWidth, height); + _timestampItem.setGeometry(timestampWidth, height); _senderItem.setPos(senderPos); _contentsItem.setPos(contentsPos); @@ -85,6 +87,9 @@ qreal ChatLine::setColumns(const qreal ×tampWidth, const qreal &senderWidth _senderItem.clearLayout(); _timestampItem.clearLayout(); + + _height = height; + return _height; } @@ -92,11 +97,13 @@ qreal ChatLine::setColumns(const qreal ×tampWidth, const qreal &senderWidth // a) calling prepareGeometryChange() immediately before setColumns() // b) calling Chatline::setPos() immediately afterwards qreal ChatLine::setGeometryByWidth(const qreal &width, const qreal &contentsWidth) { - _width = width; - _height = _contentsItem.setGeometryByWidth(contentsWidth); - _timestampItem.setHeight(_height); - _senderItem.setHeight(_height); + prepareGeometryChange(); + qreal height = _contentsItem.setGeometryByWidth(contentsWidth); + _timestampItem.setHeight(height); + _senderItem.setHeight(height); _contentsItem.clearLayout(); + _height = height; + _width = width; return _height; } @@ -151,7 +158,7 @@ void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, BufferId bufferId = model_->data(prevRowIdx, MessageModel::BufferIdRole).value(); if(msgId == Client::networkModel()->lastSeenMsgId(bufferId) && chatScene()->isSingleBufferScene()) { QtUiStyleSettings s("Colors"); - QLinearGradient gradient(0, 0, 0, height()); + QLinearGradient gradient(0, 0, 0, contentsItem().fontMetrics()->lineSpacing()); gradient.setColorAt(0, s.value("newMsgMarkerFG", QColor(Qt::red)).value()); gradient.setColorAt(0.1, Qt::transparent); painter->fillRect(boundingRect(), gradient);