diff --git a/examples/webenginewidgets/browser/main.cpp b/examples/webenginewidgets/browser/main.cpp index d49a920b58f9933ce81c0a0808d6b6cf74ee658e..0f8d238d3f588e963b99543d1783ed2ba24689c5 100644 --- a/examples/webenginewidgets/browser/main.cpp +++ b/examples/webenginewidgets/browser/main.cpp @@ -50,8 +50,6 @@ int main(int argc, char **argv) if (!application.isTheOnlyBrowser()) return 0; - QWebEngineWidgets::initialize(); - application.newMainWindow(); return application.exec(); } diff --git a/examples/webenginewidgets/fancybrowser/main.cpp b/examples/webenginewidgets/fancybrowser/main.cpp index c18b98d9dd6b00eb97bc70f7d8927d7324f6924b..e463151e98e22cf9f29ca9136be3cbc7c7e26155 100644 --- a/examples/webenginewidgets/fancybrowser/main.cpp +++ b/examples/webenginewidgets/fancybrowser/main.cpp @@ -45,7 +45,6 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); - QWebEngineWidgets::initialize(); QUrl url; if (argc > 1) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 641d05011c77699880cfeb0d6e2b74e9a12fa604..347636fe52656c81e7c9b590137aa624c04180bc 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -263,7 +263,7 @@ void ShareGroupQtQuick::AboutToAddFirstContext() // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. QOpenGLContext *shareContext = QOpenGLContextPrivate::globalShareContext(); if (!shareContext) { - qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QWebEngine::initialize() or QWebEngineWidgets::initialize() in your main() function."); + qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QWebEngine::initialize() in your main() function."); } m_shareContextQtQuick = make_scoped_refptr(new QtShareGLContext(shareContext)); } diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp index f3792248e06780653568ebca09593f4012cb51c5..cffdb74bc33c15359aeb002585ddd244dc53449c 100644 --- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp +++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp @@ -42,8 +42,11 @@ #include "qtwebenginewidgetsglobal.h" #include "qtwebengineglobal.h" +#include <QCoreApplication> -void QWebEngineWidgets::initialize() +static void initialize() { QWebEngine::initialize(); } + +Q_COREAPP_STARTUP_FUNCTION(initialize) diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.h b/src/webenginewidgets/api/qtwebenginewidgetsglobal.h index 1836de35762eb1db4ea52c73d25271df9308bd3b..d875c1cbeb2ea42ea4bfe622cd72e3ec3b251cdf 100644 --- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.h +++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.h @@ -55,12 +55,6 @@ QT_BEGIN_NAMESPACE # define QWEBENGINEWIDGETS_EXPORT #endif -class QWEBENGINEWIDGETS_EXPORT QWebEngineWidgets -{ -public: - static void initialize(); -}; - QT_END_NAMESPACE #endif // QTWEBENGINEWIDGETSGLOBAL_H diff --git a/src/webenginewidgets/doc/snippets/simple/main.cpp b/src/webenginewidgets/doc/snippets/simple/main.cpp index d33f14628e96427d43537a27be1d8a28d1f332de..bebdeff110d70441080ee0822840054f0bdae056 100644 --- a/src/webenginewidgets/doc/snippets/simple/main.cpp +++ b/src/webenginewidgets/doc/snippets/simple/main.cpp @@ -25,9 +25,6 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget *parent = 0; -//! [Initializing QWebEngineWidgets] - QWebEngineWidgets::initialize(); -//! [Initializing QWebEngineWidgets] //! [Using QWebEngineView] QWebEngineView *view = new QWebEngineView(parent); view->load(QUrl("http://qt-project.org/")); diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc index fe43ca5c47d1219c042d98756992fb47fccaf4ee..fa3954fb4900c714893f7cc50b3d2f6efa2b963c 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc @@ -85,11 +85,6 @@ \section1 Architecture - Before an application can use the Qt WebEngine Widgets classes, it must call - the static initialization method for the module. - - \snippet snippets/simple/main.cpp Initializing QWebEngineWidgets - The easiest way to render content is through the QWebEngineView class. As a widget it can be embedded into your forms or a graphics view, and it provides convenience functions for downloading and rendering web sites. diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp index d0c4fd527297cc5ef34aae6f9e1f0718829051eb..bb1bd94adbf04e9ce581335c628674c38e8ae54a 100644 --- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp +++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp @@ -46,7 +46,6 @@ private Q_SLOTS: // It is only called once. void tst_QWebEngineView::initTestCase() { - QWebEngineWidgets::initialize(); } // This will be called after the last test function is executed. diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp index 1fc4aaea504a2a1cb1d4ed7efa4c9249188c5371..1e979b3c502390d1539a26d9baa232ee09cfa39a 100644 --- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp +++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp @@ -118,7 +118,6 @@ bool tst_QWebEngineFrame::eventFilter(QObject* watched, QEvent* event) void tst_QWebEngineFrame::initTestCase() { - QWebEngineWidgets::initialize(); } void tst_QWebEngineFrame::init() diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index 07427774a24cfbc90ffafbb9ebde7375a53b74f2..a329b7307b08616a1e2d533f68cefc4b94fb8ec8 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -89,7 +89,6 @@ tst_QWebEngineHistory::~tst_QWebEngineHistory() void tst_QWebEngineHistory::initTestCase() { - QWebEngineWidgets::initialize(); } void tst_QWebEngineHistory::init() diff --git a/tests/auto/widgets/qwebenginehistoryinterface/tst_qwebenginehistoryinterface.cpp b/tests/auto/widgets/qwebenginehistoryinterface/tst_qwebenginehistoryinterface.cpp index 93714255b2f08bd4f6191af7f23d760a34310442..4666d1ba4b94fb3d730181254754ef8be018615d 100644 --- a/tests/auto/widgets/qwebenginehistoryinterface/tst_qwebenginehistoryinterface.cpp +++ b/tests/auto/widgets/qwebenginehistoryinterface/tst_qwebenginehistoryinterface.cpp @@ -61,7 +61,6 @@ tst_QWebEngineHistoryInterface::~tst_QWebEngineHistoryInterface() void tst_QWebEngineHistoryInterface::initTestCase() { - QWebEngineWidgets::initialize(); } void tst_QWebEngineHistoryInterface::init() diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index ac71e92465d73abed59dd9d5f4b3106b597400f8..ca3740715eae46d0511820f6ea330c082ef612ea 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -229,7 +229,6 @@ void tst_QWebEnginePage::cleanupFiles() void tst_QWebEnginePage::initTestCase() { - QWebEngineWidgets::initialize(); cleanupFiles(); // In case there are old files from previous runs } diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index f105fe8c8bc42e1cfe838670ad5aa4424b6a17ac..3893397cd5cce60f5c4b7a54335452788c56e49a 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -63,7 +63,6 @@ private Q_SLOTS: // It is only called once. void tst_QWebEngineView::initTestCase() { - QWebEngineWidgets::initialize(); } // This will be called after the last test function is executed.