summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2010-06-06 21:33:29 +0200
committerYoann Laissus <yoann.laissus@gmail.com>2010-06-06 21:33:29 +0200
commitafaff4050fa5ce0afad23930f4620a7546c267f9 (patch)
tree5b961a889fbedd1c89a47fccac81d66297905cce /src/webview.cpp
parentStupid me! Showing error page in mainFrame() instead of the frame originating (diff)
downloadrekonq-afaff4050fa5ce0afad23930f4620a7546c267f9.tar.xz
Fix the end value of the zoom slider with mouse wheel zoom
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 061dd256..0633bc9b 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -498,19 +498,30 @@ void WebView::keyPressEvent(QKeyEvent *event)
void WebView::wheelEvent(QWheelEvent *event)
{
+ KWebView::wheelEvent(event);
+
+
// Sync with the zoom slider
if (event->modifiers() == Qt::ControlModifier)
{
- emit zoomChanged(zoomFactor());
+ // Limits of the slider
+ if (zoomFactor() > 1.9)
+ setZoomFactor(1.9);
+ else if (zoomFactor() < 0.1)
+ setZoomFactor(0.1);
+
+ // Round the factor (Fix slider's end value)
+ int newFactor = zoomFactor() * 10;
+ if ((zoomFactor() * 10 - newFactor) > 0.5)
+ newFactor++;
+
+
+ emit zoomChanged((qreal)newFactor / 10);
}
- KWebView::wheelEvent(event);
- // Limits of the slider
- if (zoomFactor() > 1.9)
- setZoomFactor(1.9);
- else if (zoomFactor() < 0.1)
- setZoomFactor(0.1);
+
+
}