Fix chatline caching on resize
[quassel.git] / src / qtui / chatline.cpp
index 7e0acd5..99e0982 100644 (file)
@@ -59,6 +59,11 @@ ChatLine::ChatLine(int row, QAbstractItemModel *model,
   setHighlighted(index.data(MessageModel::FlagsRole).toInt() & Message::Highlight);
 }
 
+ChatLine::~ChatLine() {
+  if(chatView())
+    chatView()->setHasCache(this, false);
+}
+
 ChatItem *ChatLine::item(ChatLineModel::ColumnType column) {
   switch(column) {
     case ChatLineModel::TimestampColumn:
@@ -82,6 +87,12 @@ ChatItem *ChatLine::itemAt(const QPointF &pos) {
   return 0;
 }
 
+void ChatLine::clearCache() {
+  _timestampItem.clearCache();
+  _senderItem.clearCache();
+  _contentsItem.clearCache();
+}
+
 void ChatLine::setMouseGrabberItem(ChatItem *item) {
   _mouseGrabberItem = item;
 }
@@ -206,8 +217,7 @@ void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
     MsgId myMsgId = myIdx.data(MessageModel::MsgIdRole).value<MsgId>();
     Message::Flags flags = (Message::Flags)myIdx.data(MessageModel::FlagsRole).toInt();
 
-    // don't show the marker if we wrote that new line
-    if(!(flags & Message::Self)) {
+    if(chatView()->isMarkerLineVisible()) {
       BufferId bufferId = BufferId(chatScene()->idString().toInt());
       MsgId lastSeenMsgId = Client::networkModel()->markerLineMsgId(bufferId);
       if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) {