From 28b08c849efc361b42e79b69e76541d9b0faddd9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 27 Nov 2015 16:15:32 +0100 Subject: 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 --- tests/quicktestbrowser/main.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'tests/quicktestbrowser/main.cpp') 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 #include #include +#include #include 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); -- cgit v1.2.3