That way, the scene can inhibit autoscroll for example while selecting, or during
a click sequence (nothing is more annoying than a link that scrolls away while you have
the button still pressed...). The former is already implemented, the latter follows next
as soon as I get a decent click handling going.
}
}
+bool ChatScene::isScrollingAllowed() const {
+ if(_isSelecting)
+ return false;
+
+ // TODO: Handle clicks and single-item selections too
+
+ return true;
+}
+
void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
if(_isSelecting && event->buttons() == Qt::LeftButton) {
updateSelection(event->scenePos());
inline CutoffMode senderCutoffMode() const { return _cutoffMode; }
inline void setSenderCutoffMode(CutoffMode mode) { _cutoffMode = mode; }
+ bool isScrollingAllowed() const;
+
virtual bool event(QEvent *e);
public slots:
void ChatView::lastLineChanged(QGraphicsItem *chatLine, qreal offset) {
Q_UNUSED(chatLine)
+ if(!scene()->isScrollingAllowed())
+ return;
+
QAbstractSlider *vbar = verticalScrollBar();
Q_ASSERT(vbar);
if(vbar->maximum() - vbar->value() <= (offset + 5) * _currentScaleFactor ) { // 5px grace area