summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets/printme/doc/src/printme.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webenginewidgets/printme/doc/src/printme.qdoc')
-rw-r--r--examples/webenginewidgets/printme/doc/src/printme.qdoc42
1 files changed, 11 insertions, 31 deletions
diff --git a/examples/webenginewidgets/printme/doc/src/printme.qdoc b/examples/webenginewidgets/printme/doc/src/printme.qdoc
index f17fae1a8..91aecf6de 100644
--- a/examples/webenginewidgets/printme/doc/src/printme.qdoc
+++ b/examples/webenginewidgets/printme/doc/src/printme.qdoc
@@ -1,32 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example webenginewidgets/printme
+ \example webenginewidgets/printme
+ \examplecategory {Web Technologies}
\title WebEngine Widgets PrintMe Example
\ingroup webengine-widgetexamples
\brief Demonstrates how to print web pages using Qt WebEngine Widgets.
@@ -78,9 +55,11 @@
Now we can implement the \c{PrintHandler::printDocument()} slot, which is
called in response to the \l{QPrintPreviewDialog::paintRequested} signal.
To do actual painting on a printer, we call the \l QWebEngineView::print()
- function. Because this call is asynchronous, we need to use
- a local event loop. We begin the local event loop by calling
- \l{QEventLoop::exec()}.
+ function. Printing is an async operation in Chromium, but not in Qt, so we
+ run a local event loop using \l{QEventLoop::exec()} to make sure printing
+ is done before returning. User input is blocked, since clicking on a button
+ while we're waiting for the print to finish can mess up the internal state
+ and cause a crash.
\quotefromfile webenginewidgets/printme/printhandler.cpp
\skipto PrintHandler::printDocument(
@@ -89,7 +68,8 @@
To get notified about the result of printing job, we implement
\c{PrintHandler::printFinished()} slot as handler of
\l QWebEngineView::printFinished() signal. We check for \c{success} and
- report any errors that occurred.
+ report any errors that occurred. Finally, we call \l{QEventLoop::quit()}
+ to exit out of the local event loop.
\quotefromfile webenginewidgets/printme/printhandler.cpp
\skipto PrintHandler::printFinished(