summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp1
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/webview.cpp17
-rw-r--r--src/webview.h2
5 files changed, 23 insertions, 3 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 84dc70af..0b17ef2a 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -329,6 +329,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent)
connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
connect(tab->view(), SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &)));
connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &)));
+ connect(tab->view(), SIGNAL(zoomChanged(qreal)), m_parentWindow, SLOT(setZoomSliderFactor(qreal)));
// connecting webPage signals with mainview
connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d5b81c1e..dc29d2eb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -906,7 +906,7 @@ void MainWindow::setZoomFactor(int factor)
void MainWindow::setZoomSliderFactor(qreal factor)
{
- m_zoomSlider->setValue(factor*10);
+ m_zoomSlider->setValue(factor * 10);
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index ffc91086..8acbef56 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -78,8 +78,6 @@ public:
virtual QSize sizeHint() const;
void setWidgetsVisible(bool makeFullScreen);
- void setZoomSliderFactor(qreal factor);
-
private:
void setupActions();
void setupTools();
@@ -103,6 +101,8 @@ public slots:
void updateActions();
+ void setZoomSliderFactor(qreal factor);
+
signals:
// switching tabs
void ctrlTabPressed();
diff --git a/src/webview.cpp b/src/webview.cpp
index a26cf63f..061dd256 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -496,6 +496,23 @@ void WebView::keyPressEvent(QKeyEvent *event)
KWebView::keyPressEvent(event);
}
+void WebView::wheelEvent(QWheelEvent *event)
+{
+ // Sync with the zoom slider
+ if (event->modifiers() == Qt::ControlModifier)
+ {
+ emit zoomChanged(zoomFactor());
+ }
+
+ KWebView::wheelEvent(event);
+
+ // Limits of the slider
+ if (zoomFactor() > 1.9)
+ setZoomFactor(1.9);
+ else if (zoomFactor() < 0.1)
+ setZoomFactor(0.1);
+}
+
void WebView::inspect()
{
diff --git a/src/webview.h b/src/webview.h
index bac12e99..a4ba676c 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -56,6 +56,7 @@ protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
+ void wheelEvent(QWheelEvent *event);
private slots:
void search();
@@ -73,6 +74,7 @@ private slots:
signals:
void loadUrl(const KUrl &, const Rekonq::OpenType &);
+ void zoomChanged(qreal);
private:
QPoint _mousePos;