diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-21 11:38:27 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-21 11:40:49 +0100 |
commit | d9349a299f66fb154ad24f410451872a7ca253fb (patch) | |
tree | 2e8258ef3679707a2a9245c85bc8490251b3e256 /examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc | |
parent | 50bc8b124705c33c5e27f035b1eab756e14247ba (diff) | |
parent | c0aa9d794378846e4cc0b6fe94f2765bc31cefdd (diff) |
Merge remote-tracking branch 'origin/wip/qtpdf' into 5.15v5.15.0-beta1
The feature set is mostly in place (except for some known shortcomings)
and we need the merge to build it on iOS.
Task-number: QTBUG-69519
Change-Id: Ib1ac82a9a7e0830d98d1c4327a1b15d4d7f4d4c1
Diffstat (limited to 'examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc')
-rw-r--r-- | examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc new file mode 100644 index 000000000..9c7b3deed --- /dev/null +++ b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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$ +** +****************************************************************************/ + +/*! + \example pdfviewer + \ingroup qtpdf-examples + + \title PDF Viewer Example + \brief Renders PDF documents. + + \image pdfviewer.png + + \e {PDF Viewer} demonstrates how to use the \l QPdfDocument class to render + PDF documents and the \l QPdfPageNavigation class to navigate them. + + Qt Creator and the integrated Qt Designer were used to create the example + UI and to connect it to the code. This affects the code, which might be + somewhat different to what you would typically write by hand. + For more information about using Qt Designer, see \l{Qt Designer Manual} + and \l{Qt Creator: Creating a Qt Widget Based Application}. + + \include examples-run.qdocinc + + \section1 Creating the Main Window + + The MainWindow class inherits the QMainWindow class: + + \quotefromfile pdfviewer/mainwindow.h + \skipto public QMainWindow + \printuntil ~MainWindow() + + The class declares public and private slots that match the actions of the + selectors: + + \printuntil on_actionContinuous_triggered() + + The actual layout of the main window is specified in a \c{.ui} file. The + widgets and actions are available at runtime in the \c ui member variable. + + \printuntil Ui:: + + The \c m_zoomSelector variable holds the zoom selector and the + \c m_pageSelector holds the page selector. The \c m_document + variable is an instance of the QPdfDocument class that contains + the PDF document. + + \printuntil } + + The actual setup of the different objects is done in the MainWindow + constructor: + + \quotefromfile pdfviewer/mainwindow.cpp + \skipto MainWindow:: + \printuntil { + + The constructor first calls \c setupUi() to construct the zoom and page + selectors according to the UI file. We set the maximum width of the + selectors. + + \printuntil addWidget(m_pageSelector) + + We use the \l QPdfPageNavigation class to handle the navigation through a + PDF document: + + \printuntil setPageNavigation + + We connect the \c zoomModeChanged and \c zoomFactor changed signals of the + PDF view to the functions that reset the zoom selector: + + \printuntil reset() + + We then load the PDF document to the viewer: + + \dots + \skipto pdfView + \printuntil ; + + Finally, we connect the \c zoomFactorChanged signal to the function that + sets the value of the zoom selector: + + \printuntil } + + \section1 Files and Attributions +*/ |