diff options
author | Pierre Rossi <pierre.rossi@digia.com> | 2013-09-30 11:48:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-01 22:49:24 +0200 |
commit | 8c1de0f07a4b83ad50278231a8866143cf01333c (patch) | |
tree | f1035fcbcf075a201ec0650d64e11c78ebbfb0b1 /lib/web_contents_adapter.cpp | |
parent | e316bab5cf7d5c48ded7a49f84ef0ddf02fd413b (diff) |
Widgets: implement zoomFactor
Change-Id: I7ef26e4a2e6c9eb228bcf5542ad272b998f8c6a3
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'lib/web_contents_adapter.cpp')
-rw-r--r-- | lib/web_contents_adapter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/web_contents_adapter.cpp b/lib/web_contents_adapter.cpp index 7fa180e70..6a914af99 100644 --- a/lib/web_contents_adapter.cpp +++ b/lib/web_contents_adapter.cpp @@ -50,6 +50,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/common/page_zoom.h" #include "content/public/common/renderer_preferences.h" #include <QGuiApplication> @@ -226,3 +227,18 @@ void WebContentsAdapter::clearNavigationHistory() if (d->webContents->GetController().CanPruneAllButVisible()) d->webContents->GetController().PruneAllButVisible(); } + +void WebContentsAdapter::setZoomFactor(qreal factor) +{ + Q_D(WebContentsAdapter); + if (content::RenderViewHost *rvh = d->webContents->GetRenderViewHost()) { + rvh->SetZoomLevel(content::ZoomFactorToZoomLevel(static_cast<double>(factor))); + } + +} + +qreal WebContentsAdapter::currentZoomFactor() const +{ + Q_D(const WebContentsAdapter); + return static_cast<qreal>(content::ZoomLevelToZoomFactor(d->webContents->GetZoomLevel())); +} |