diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/data/autoscroll.png | bin | 0 -> 1414 bytes | |||
-rw-r--r-- | src/webview.cpp | 32 | ||||
-rw-r--r-- | src/webview.h | 3 |
4 files changed, 24 insertions, 13 deletions
diff --git a/src/data/CMakeLists.txt b/src/data/CMakeLists.txt index 6aef22ec..555f5abf 100644 --- a/src/data/CMakeLists.txt +++ b/src/data/CMakeLists.txt @@ -3,7 +3,7 @@ INSTALL( FILES bg2.png bg.png tile.gif category.png button.png busywidget.gif loading.mng - webkit-icon.png + webkit-icon.png autoscroll.png DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics ) diff --git a/src/data/autoscroll.png b/src/data/autoscroll.png Binary files differnew file mode 100644 index 00000000..70e34c61 --- /dev/null +++ b/src/data/autoscroll.png diff --git a/src/webview.cpp b/src/webview.cpp index f72041bf..7c02ee06 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -72,6 +72,7 @@ WebView::WebView(QWidget* parent) , m_hScrollSpeed(0) , m_canEnableAutoScroll(true) , m_isAutoScrollEnabled(false) + , m_autoScrollIndicator(QPixmap(KStandardDirs::locate("appdata" , "pics/autoscroll.png"))) , m_smoothScrollTimer(new QTimer(this)) , m_smoothScrolling(false) , m_dy(0) @@ -354,11 +355,11 @@ void WebView::mousePressEvent(QMouseEvent *event) { if (m_isAutoScrollEnabled) { - setCursor(Qt::ArrowCursor); m_vScrollSpeed = 0; m_hScrollSpeed = 0; m_autoScrollTimer->stop(); m_isAutoScrollEnabled = false; + update(); return; } @@ -384,9 +385,9 @@ void WebView::mousePressEvent(QMouseEvent *event) if (!page()->currentFrame()->scrollBarGeometry(Qt::Horizontal).isNull() || !page()->currentFrame()->scrollBarGeometry(Qt::Vertical).isNull()) { - setCursor(KIcon("transform-move").pixmap(32)); m_clickPos = event->pos(); m_isAutoScrollEnabled = true; + update(); } } break; @@ -430,15 +431,6 @@ void WebView::mouseMoveEvent(QMouseEvent *event) } -void WebView::enterEvent(QEvent *event) -{ - if (m_isAutoScrollEnabled) - setCursor(KIcon("transform-move").pixmap(32)); - - KWebView::enterEvent(event); -} - - void WebView::dropEvent(QDropEvent *event) { bool isEditable = page()->frameAt(event->pos())->hitTestContent(event->pos()).isContentEditable(); @@ -475,6 +467,24 @@ void WebView::dropEvent(QDropEvent *event) } } + +void WebView::paintEvent(QPaintEvent* event) +{ + KWebView::paintEvent(event); + + if (m_isAutoScrollEnabled) + { + QPoint centeredPoint = m_clickPos; + centeredPoint.setX(centeredPoint.x() - m_autoScrollIndicator.width() / 2); + centeredPoint.setY(centeredPoint.y() - m_autoScrollIndicator.height() / 2); + + QPainter painter(this); + painter.setOpacity(0.8); + painter.drawPixmap(centeredPoint, m_autoScrollIndicator); + } +} + + void WebView::search() { KAction *a = qobject_cast<KAction*>(sender()); diff --git a/src/webview.h b/src/webview.h index 1fec1ae4..b3db5ce0 100644 --- a/src/webview.h +++ b/src/webview.h @@ -61,12 +61,12 @@ protected: void contextMenuEvent(QContextMenuEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); - void enterEvent(QEvent *event); void keyPressEvent(QKeyEvent *event); void wheelEvent(QWheelEvent *event); void dropEvent(QDropEvent *event); void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent * event); + void paintEvent(QPaintEvent *event); private Q_SLOTS: void search(); @@ -105,6 +105,7 @@ private: int m_hScrollSpeed; bool m_canEnableAutoScroll; bool m_isAutoScrollEnabled; + QPixmap m_autoScrollIndicator; // Smooth Scroll QTimer *const m_smoothScrollTimer; |