diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-11-27 16:15:32 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-12-12 11:28:00 +0000 |
commit | 28b08c849efc361b42e79b69e76541d9b0faddd9 (patch) | |
tree | a287d3e3856d611137f051c442a1d1f06f3a2bfa /tests/quicktestbrowser/main.cpp | |
parent | 66988974a0eba36b6523b771bf6b078aa155a810 (diff) |
Make QQuickWebEngineProfile public
Make QQuickWebEngineProfile a publicly exported class.
This allows users to set up and manipulate the profile from
C++, and removes the ugly hack needed to access the cookie store.
Change-Id: I99e1a8c2cb99d9d1a14e1c78bec5948ba1282fb3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'tests/quicktestbrowser/main.cpp')
-rw-r--r-- | tests/quicktestbrowser/main.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp index 12ebfa2d5..61977a018 100644 --- a/tests/quicktestbrowser/main.cpp +++ b/tests/quicktestbrowser/main.cpp @@ -52,6 +52,7 @@ typedef QGuiApplication Application; #include <QtQml/QQmlContext> #include <QtQml/QQmlComponent> #include <QtWebEngine/qtwebengineglobal.h> +#include <QtWebEngine/QQuickWebEngineProfile> #include <QtWebEngineCore/qwebenginecookiestore.h> static QUrl startupUrl() @@ -84,17 +85,10 @@ int main(int argc, char **argv) appEngine.load(QUrl("qrc:/ApplicationRoot.qml")); QObject *rootObject = appEngine.rootObjects().first(); - QQmlComponent component(&appEngine); - component.setData(QByteArrayLiteral("import QtQuick 2.0\n" - "import QtWebEngine 1.1\n" - "WebEngineProfile {\n" - "storageName: \"Test\"\n" - "}") - , QUrl()); - QObject *profile = component.create(); + QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject); + QWebEngineCookieStore *client = profile->cookieStore(); + const QMetaObject *rootMeta = rootObject->metaObject(); - QWebEngineCookieStore *client = 0; - QMetaObject::invokeMethod(profile, "cookieStore", Q_RETURN_ARG(QWebEngineCookieStore*, client)); int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled"); Q_ASSERT(index != -1); QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index); |