X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatview.cpp;h=2a999ea19de9c7cf5c7a08a94e75df29f79c43cb;hb=4faeafb743766b345d5cadc5289840a981413853;hp=024e49d602b4f7e3d04e1ceb017dac6bce809235;hpb=16e4a21c1292448c1a524010d70f6e59b84802f4;p=quassel.git diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index 024e49d6..2a999ea1 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -19,11 +19,11 @@ ***************************************************************************/ #include +#include #include #include #include "bufferwidget.h" -#include "chatlinemodelitem.h" #include "chatscene.h" #include "chatview.h" #include "client.h" @@ -70,11 +70,37 @@ void ChatView::init(MessageFilter *filter) { connect(_scene, SIGNAL(lastLineChanged(QGraphicsItem *, qreal)), this, SLOT(lastLineChanged(QGraphicsItem *, qreal))); connect(_scene, SIGNAL(mouseMoveWhileSelecting(const QPointF &)), this, SLOT(mouseMoveWhileSelecting(const QPointF &))); setScene(_scene); - // installEventFilter(_scene); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(verticalScrollbarChanged(int))); } +bool ChatView::event(QEvent *event) { + if(event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + switch(keyEvent->key()) { + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_PageUp: + case Qt::Key_PageDown: + if(!verticalScrollBar()->isVisible()) { + scene()->requestBacklog(); + return true; + } + default: + break; + } + } + + if(event->type() == QEvent::Wheel) { + if(!verticalScrollBar()->isVisible()) { + scene()->requestBacklog(); + return true; + } + } + + return QGraphicsView::event(event); +} + void ChatView::resizeEvent(QResizeEvent *event) { QGraphicsView::resizeEvent(event);