diff options
author | Marc Deop <damnshock@gmail.com> | 2012-01-09 19:04:29 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-01-09 19:04:29 +0100 |
commit | 81bf91dc7d81a06de3f5c16c79c34385e0091cbd (patch) | |
tree | 7f91d30ff800c73a2da081f2683309aae6b3088e | |
parent | Fix issue with new ordering algorithm (diff) | |
download | rekonq-81bf91dc7d81a06de3f5c16c79c34385e0091cbd.tar.xz |
Let keys autoscroll work also when middle click use is disabled
(adjam's marginal change): let variables have better names
m_isAutoScrollEnabled --> m_isViewAutoScrolling
CCBUG:289588
CCBUG:278056
REVIEW:103649
REVIEWED-BY: adjam
-rw-r--r-- | src/webview.cpp | 16 | ||||
-rw-r--r-- | src/webview.h | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index 28285a04..8a4cc4ba 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -70,7 +70,7 @@ WebView::WebView(QWidget* parent) , m_vScrollSpeed(0) , m_hScrollSpeed(0) , m_canEnableAutoScroll(true) - , m_isAutoScrollEnabled(false) + , m_isViewAutoScrolling(false) , m_autoScrollIndicator(QPixmap(KStandardDirs::locate("appdata" , "pics/autoscroll.png"))) , m_smoothScrollTimer(new QTimer(this)) , m_smoothScrolling(false) @@ -379,12 +379,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) void WebView::mousePressEvent(QMouseEvent *event) { - if (m_isAutoScrollEnabled) + if (m_isViewAutoScrolling) { m_vScrollSpeed = 0; m_hScrollSpeed = 0; m_autoScrollTimer->stop(); - m_isAutoScrollEnabled = false; + m_isViewAutoScrolling = false; + m_canEnableAutoScroll = true; update(); return; } @@ -404,7 +405,7 @@ void WebView::mousePressEvent(QMouseEvent *event) case Qt::MidButton: if (m_canEnableAutoScroll - && !m_isAutoScrollEnabled + && !m_isViewAutoScrolling && !page()->currentFrame()->scrollBarGeometry(Qt::Horizontal).contains(event->pos()) && !page()->currentFrame()->scrollBarGeometry(Qt::Vertical).contains(event->pos())) { @@ -412,7 +413,7 @@ void WebView::mousePressEvent(QMouseEvent *event) || !page()->currentFrame()->scrollBarGeometry(Qt::Vertical).isNull()) { m_clickPos = event->pos(); - m_isAutoScrollEnabled = true; + m_isViewAutoScrolling = true; update(); } } @@ -436,6 +437,7 @@ void WebView::mousePressEvent(QMouseEvent *event) break; default: + m_canEnableAutoScroll = true; break; }; KWebView::mousePressEvent(event); @@ -446,7 +448,7 @@ void WebView::mouseMoveEvent(QMouseEvent *event) { m_mousePos = event->pos(); - if (m_isAutoScrollEnabled) + if (m_isViewAutoScrolling) { QPoint r = m_mousePos - m_clickPos; m_hScrollSpeed = r.x() / 2; // you are too fast.. @@ -515,7 +517,7 @@ void WebView::paintEvent(QPaintEvent* event) { KWebView::paintEvent(event); - if (m_isAutoScrollEnabled) + if (m_isViewAutoScrolling) { QPoint centeredPoint = m_clickPos; centeredPoint.setX(centeredPoint.x() - m_autoScrollIndicator.width() / 2); diff --git a/src/webview.h b/src/webview.h index eabe10a0..95f27f17 100644 --- a/src/webview.h +++ b/src/webview.h @@ -115,7 +115,7 @@ private: int m_vScrollSpeed; int m_hScrollSpeed; bool m_canEnableAutoScroll; - bool m_isAutoScrollEnabled; + bool m_isViewAutoScrolling; QPixmap m_autoScrollIndicator; // Smooth Scroll |