Commit 3e11e30a authored by Aurindam Jana's avatar Aurindam Jana

ScriptConsole: Scrolling behaviour

Keep scrolling when new items are added only if the
scrollbar is at the bottom.

Change-Id: Id520585fed0ecc63be8bf1850b72af7df8a2d491
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent a9cd2504
......@@ -47,6 +47,7 @@
#include <QAbstractProxyModel>
#include <QFileInfo>
#include <QUrl>
#include <QScrollBar>
namespace Debugger {
namespace Internal {
......@@ -115,6 +116,13 @@ QtMessageLogView::QtMessageLogView(QWidget *parent) :
SLOT(onRowActivated(QModelIndex)));
}
void QtMessageLogView::onScrollToBottom()
{
//Keep scrolling to bottom if scroll bar is at maximum()
if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
scrollToBottom();
}
void QtMessageLogView::mousePressEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
......
......@@ -44,6 +44,9 @@ class QtMessageLogView : public QTreeView
public:
explicit QtMessageLogView(QWidget *parent = 0);
public slots:
void onScrollToBottom();
protected:
void mousePressEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *e);
......
......@@ -159,7 +159,7 @@ QtMessageLogWindow::QtMessageLogWindow(QWidget *parent)
connect(m_proxyModel,
SIGNAL(scrollToBottom()),
m_treeView,
SLOT(scrollToBottom()));
SLOT(onScrollToBottom()));
m_itemDelegate = new QtMessageLogItemDelegate(this);
connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment