diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-09 16:00:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-12 09:05:16 +0000 |
commit | 8ce1b9e5d67f1789a45d8d73960a892f77f34b06 (patch) | |
tree | 7117d1078477d51161e1ecb00d82c84b9ccdb5f0 /src/webengine | |
parent | 70558b6850ff6ca5289f5a0fbbd6729a72291cf3 (diff) |
Add scrollPosition API
Adds an API to read the main-frame scrollPosition.
In QtWebKit this property used to be in QWebFrame.
Task-number: QTBUG-48323
Change-Id: Ic8312afac0dcdcfd8c7fd4589be774d327bb6268
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 12 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p.h | 3 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index b22b2798e..1a8a19993 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -893,6 +893,12 @@ void QQuickWebEngineViewPrivate::moveValidationMessage(const QRect &anchor) ui()->moveMessageBubble(anchor); } +void QQuickWebEngineViewPrivate::updateScrollPosition(const QPointF &position) +{ + Q_Q(QQuickWebEngineView); + Q_EMIT q->scrollPositionChanged(position); +} + void QQuickWebEngineViewPrivate::renderProcessTerminated( RenderProcessTerminationStatus terminationStatus, int exitCode) { @@ -1302,6 +1308,12 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) } } +QPointF QQuickWebEngineView::scrollPosition() const +{ + Q_D(const QQuickWebEngineView); + return d->adapter->lastScrollOffset(); +} + void QQuickWebEngineViewPrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script) { Q_ASSERT(p && p->data); diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 22cca3277..aaf4c4bcf 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -104,6 +104,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { Q_PROPERTY(QQmlListProperty<QQuickWebEngineScript> userScripts READ userScripts FINAL REVISION 1) Q_PROPERTY(bool activeFocusOnPress READ activeFocusOnPress WRITE setActiveFocusOnPress NOTIFY activeFocusOnPressChanged REVISION 2) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 2) + Q_PROPERTY(QPointF scrollPosition READ scrollPosition NOTIFY scrollPositionChanged FINAL REVISION 3) #ifdef ENABLE_QML_TESTSUPPORT_API Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport FINAL) @@ -137,6 +138,7 @@ public: void setZoomFactor(qreal arg); QColor backgroundColor() const; void setBackgroundColor(const QColor &color); + QPointF scrollPosition() const; QQuickWebEngineViewExperimental *experimental() const; @@ -305,6 +307,7 @@ Q_SIGNALS: Q_REVISION(2) void activeFocusOnPressChanged(bool); Q_REVISION(2) void backgroundColorChanged(); Q_REVISION(2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode); + Q_REVISION(3) void scrollPositionChanged(const QPointF& position); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 0140111b9..3e6aa6317 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -169,6 +169,7 @@ public: virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE; virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) Q_DECL_OVERRIDE; + virtual void updateScrollPosition(const QPointF &position) Q_DECL_OVERRIDE; virtual QtWebEngineCore::BrowserContextAdapter *browserContextAdapter() Q_DECL_OVERRIDE; |