}
void ChatScene::setMarkerLine(MsgId msgId) {
- if(msgId.isValid()) {
- ChatLine *line = chatLine(msgId, false);
- if(line) {
- // if this was the last line, we won't see it because it's outside the sceneRect
- // .. which is exactly what we want :)
- _markerLine->setPos(line->pos() + QPointF(0, line->height()));
-
- // DayChange messages might have been hidden outside the scene rect, don't make the markerline visible then!
- if(_markerLine->pos().y() >= sceneRect().y()) {
- _markerLineValid = true;
- if(_markerLineVisible)
- _markerLine->setVisible(true);
- return;
- }
+ if(!isSingleBufferScene())
+ return;
+ if(!msgId.isValid()) {
+ msgId = Client::markerLine(singleBufferId());
+ if(!msgId.isValid()) {
+ _markerLineValid = false;
+ _markerLine->setVisible(false);
+ return;
+ }
+ }
+
+ ChatLine *line = chatLine(msgId, false);
+ if(line) {
+ // if this was the last line, we won't see it because it's outside the sceneRect
+ // .. which is exactly what we want :)
+ _markerLine->setPos(line->pos() + QPointF(0, line->height()));
+
+ // DayChange messages might have been hidden outside the scene rect, don't make the markerline visible then!
+ if(_markerLine->pos().y() >= sceneRect().y()) {
+ _markerLineValid = true;
+ if(_markerLineVisible)
+ _markerLine->setVisible(true);
+ return;
}
}
- _markerLineValid = false;
- _markerLine->setVisible(false);
}
void ChatScene::rowsInserted(const QModelIndex &index, int start, int end) {
}
// now move the marker line if necessary. we don't need to do anything if we appended lines though...
- if(isSingleBufferScene()) {
- if(!_markerLineValid || !atBottom) {
- MsgId msgId = Client::markerLine(singleBufferId());
- setMarkerLine(msgId);
- }
- }
+ if(!_markerLineValid || !atBottom)
+ setMarkerLine();
}
void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) {
void ChatScene::rowsRemoved() {
// move the marker line if necessary
- if(isSingleBufferScene()) {
- MsgId msgId = Client::markerLine(singleBufferId());
- setMarkerLine(msgId);
- }
+ setMarkerLine();
}
void ChatScene::dataChanged(const QModelIndex &tl, const QModelIndex &br) {
updateSceneRect(width);
setHandleXLimits();
+ setMarkerLine();
emit layoutChanged();
// clock_t endT = clock();