From 031b93abed083562bee555da02c0fc56369d10bf Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Mon, 16 Aug 2021 14:19:36 +0200 Subject: Update documentation notes for build with WebEngine modules Add cmake usage snippets for module's libraries. Remove quick version from code snippets. Fix minor documentation warnings. Fixes: QTBUG-94937 Change-Id: I2e5c8616ceeab495f604e135bb2aa2261c50c68d Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit e3cc8e0283daa989ca6957a7100c2c11669f5d1f) Reviewed-by: Qt Cherry-pick Bot --- src/core/api/qwebenginenewwindowrequest.cpp | 2 +- src/core/api/qwebenginepage.cpp | 4 ++-- .../doc/snippets/qtwebenginecore_build_snippet.qdoc | 5 +++++ src/core/doc/src/qtwebenginecore-index.qdoc | 5 +++++ src/core/doc/src/qtwebenginecore-module.qdoc | 12 ++++++++++-- .../doc/snippets/qtwebengine_build_snippet.qdoc | 9 +++++++-- .../qtwebengine_webengineview_newviewrequested.qml | 6 +++--- src/webenginequick/doc/src/qtwebengine-module.qdoc | 12 ++++++++++-- src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc | 19 ++++++++++--------- src/webenginewidgets/api/qwebengineview.cpp | 2 +- .../snippets/qtwebenginewidgets_build_snippet.qdoc | 5 +++++ .../doc/src/qtwebenginewidgets-index.qdoc | 5 +++++ .../doc/src/qtwebenginewidgets-module.qdoc | 9 ++++++++- 13 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/core/api/qwebenginenewwindowrequest.cpp b/src/core/api/qwebenginenewwindowrequest.cpp index 1322bb4dd..9fc025c0e 100644 --- a/src/core/api/qwebenginenewwindowrequest.cpp +++ b/src/core/api/qwebenginenewwindowrequest.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE /*! \qmltype WebEngineNewViewRequest - \instantiates QQuickWebEngineNewViewRequest + \instantiates QWebEngineNewWindowRequest \inqmlmodule QtWebEngineQuick \since QtWebEngine 1.1 diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 17e138920..f2c903638 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -2275,7 +2275,7 @@ QSizeF QWebEnginePage::contentsSize() const Renders the current content of the page into a PDF document and saves it in the location specified in \a filePath. The page size and orientation of the produced PDF document are taken from - the values specified in \a pageLayout, while the range of pages printed is + the values specified in \a layout, while the range of pages printed is taken from \a ranges with the default being printing all pages. This method issues an asynchronous request for printing the web page into @@ -2302,7 +2302,7 @@ void QWebEnginePage::printToPdf(const QString &filePath, const QPageLayout &layo /*! Renders the current content of the page into a PDF document and returns a byte array containing the PDF data as parameter to \a resultCallback. - The page size and orientation of the produced PDF document are taken from the values specified in \a pageLayout, + The page size and orientation of the produced PDF document are taken from the values specified in \a layout, while the range of pages printed is taken from \a ranges with the default being printing all pages. The \a resultCallback must take a const reference to a QByteArray as parameter. If printing was successful, this byte array diff --git a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc index 94e26c9c5..43421bafb 100644 --- a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc +++ b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc @@ -33,3 +33,8 @@ QT += webenginecore //! [1] #include //! [1] + +//! [2] +find_package(Qt6 COMPONENTS WebEngineCore REQUIRED) +target_link_libraries(target PRIVATE Qt::WebEngineCore) +//! [2] diff --git a/src/core/doc/src/qtwebenginecore-index.qdoc b/src/core/doc/src/qtwebenginecore-index.qdoc index 692e33d1d..0fdde2257 100644 --- a/src/core/doc/src/qtwebenginecore-index.qdoc +++ b/src/core/doc/src/qtwebenginecore-index.qdoc @@ -44,6 +44,11 @@ \snippet qtwebenginecore_build_snippet.qdoc 0 + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebenginecore_build_snippet.qdoc 2 + \section1 Articles and Guides \list diff --git a/src/core/doc/src/qtwebenginecore-module.qdoc b/src/core/doc/src/qtwebenginecore-module.qdoc index c976d024c..033d81116 100644 --- a/src/core/doc/src/qtwebenginecore-module.qdoc +++ b/src/core/doc/src/qtwebenginecore-module.qdoc @@ -33,6 +33,8 @@ \since 5.6 \ingroup qtwebengine-modules \ingroup modules + \qtvariable webenginecore + \qtcmakepackage WebEngineCore To include the definitions of the module's classes, use the following directive: @@ -44,10 +46,16 @@ \l{Qt WebEngine Widgets C++ Classes}{Qt WebEngine Widgets} modules. \if !defined(qtforpython) - To link against the module, add this line to your qmake project file: + To link against the module using build with qmake, + add this line to your qmake project file: \snippet qtwebenginecore_build_snippet.qdoc 0 - However, \c webenginecore is implied by adding \c webengine or \c webenginewidgets. + However, \c webenginecore is implied by adding \c webenginequick or \c webenginewidgets. + + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebenginecore_build_snippet.qdoc 2 \endif */ diff --git a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc index 35bc480bb..b21efbdf9 100644 --- a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc +++ b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc @@ -26,10 +26,15 @@ ****************************************************************************/ //! [0] -QT += webengine +QT += webenginequick //! [0] //! [1] -#include +#include //! [1] + +//! [2] +find_package(Qt6 COMPONENTS WebEngineQuick REQUIRED) +target_link_libraries(target PRIVATE Qt::WebEngineQuick) +//! [2] diff --git a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml index 0835c5246..70afea2b9 100644 --- a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml +++ b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml @@ -48,9 +48,9 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Window 2.1 -import QtWebEngine 2.0 +import QtQuick +import QtQuick.Window +import QtWebEngine //! [0] QtObject { diff --git a/src/webenginequick/doc/src/qtwebengine-module.qdoc b/src/webenginequick/doc/src/qtwebengine-module.qdoc index 5554bd519..ab6fc49ca 100644 --- a/src/webenginequick/doc/src/qtwebengine-module.qdoc +++ b/src/webenginequick/doc/src/qtwebengine-module.qdoc @@ -26,10 +26,13 @@ ****************************************************************************/ /*! - \module QtWebEngine - \title Qt WebEngine C++ Classes + \module QtWebEngineQuick + \title Qt WebEngine Quick C++ Classes \brief Exposes C++ functionality to Qt Quick. \ingroup modules + \ingroup qtwebengine-modules + \qtvariable webenginequick + \qtcmakepackage WebEngineQuick The \QWE module exposes C++ functionality to Qt Quick. @@ -42,5 +45,10 @@ To link against the module, add the following to your qmake project file: \snippet qtwebengine_build_snippet.qdoc 0 + + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebengine_build_snippet.qdoc 2 \endif */ diff --git a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc index 4fd7e3a3b..ac1fff80b 100644 --- a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc +++ b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \qmlmodule QtWebEngine 1.10 + \qmlmodule QtWebEngine \title Qt WebEngine QML Types \brief Provides QML types for rendering web content within a QML application. \ingroup qtwebengine-modules @@ -35,14 +35,15 @@ The QML types can be imported into your application using the following import statements in your .qml file: - \qml - import QtWebEngine 1.10 - \endqml + \snippet qtwebengine_build_snippet.qdoc 1 - To link against the module, add the following QT variable to your qmake .pro - file: + To link against the module using build with qmake, + add the following QT variable to your qmake .pro file: - \badcode - QT += webengine - \endcode + \snippet qtwebengine_build_snippet.qdoc 0 + + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebengine_build_snippet.qdoc 2 */ diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index d312fe70c..635bb10ea 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -620,7 +620,7 @@ QWebEngineView::~QWebEngineView() /*! \since 6.2 - Returns the view if any, associated with the page. + Returns the view if any, associated with the \a page. \sa page(), setPage() */ diff --git a/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc b/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc index 38366db17..f48932eae 100644 --- a/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc +++ b/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc @@ -33,3 +33,8 @@ QT += webenginewidgets //! [1] #include //! [1] + +//! [2] +find_package(Qt6 COMPONENTS WebEngineWidgets REQUIRED) +target_link_libraries(target PRIVATE Qt::WebEngineWidgets) +//! [2] diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc index b93bc86f2..cc1a33464 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc @@ -43,6 +43,11 @@ \snippet qtwebengine_build_snippet.qdoc 0 + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebengine_build_snippet.qdoc 2 + \section1 Articles and Guides \list diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc index 6f3eac5ad..a2775d641 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc @@ -32,6 +32,7 @@ \ingroup modules \ingroup qtwebengine-modules \qtvariable webenginewidgets + \qtcmakepackage WebEngineWidgets The \QWEWidgets module provides a web browser engine as well as C++ classes to render and interact with web content. @@ -42,8 +43,14 @@ \snippet qtwebenginewidgets_build_snippet.qdoc 1 \if !defined(qtforpython) - To link against the module, add the following to your qmake project file: + To link against the module using build with qmake, + add the following QT variable to your qmake .pro file: \snippet qtwebenginewidgets_build_snippet.qdoc 0 + + For build with CMake use the \c find_package() command to locate the needed module components + in the Qt6 package and \c target_link_libraries() to link against the module: + + \snippet qtwebenginewidgets_build_snippet.qdoc 2 \endif */ -- cgit v1.2.3