- // update selection
- if(_selectionStart >= 0) {
- int offset = end - start + 1;
- if(_selectionStart >= start)
- _selectionStart -= offset;
- if(_selectionEnd >= start)
- _selectionEnd -= offset;
- if(_firstSelectionRow >= start)
- _firstSelectionRow -= offset;
- if(_lastSelectionRow >= start)
- _lastSelectionRow -= offset;
- }
-
- // reposition remaining chatlines
- if(h > 0) {
- Q_ASSERT(_height >= h);
- _height -= h;
- for(int i = start; i < _lines.count(); i++) {
- _lines.at(i)->moveBy(0, -h);
- }
- setSceneRect(QRectF(0, 0, _width, _height));
- emit heightChanged(_height);
+ // update sceneRect
+ if(atBottom) {
+ setSceneRect(sceneRect().adjusted(0, 0, 0, -h));
+ } else {
+ setSceneRect(sceneRect().adjusted(0, h, 0, 0));