Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qpdfpageselector.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qpdfpageselector.h"
6
7#include <QPdfDocument>
8
10
12 : q_ptr(q)
13{
14}
15
17{
20 q->setMaximum(document->pageCount());
21 q->setValue(0);
22 }
23}
24
41 , d_ptr(new QPdfPageSelectorPrivate(this))
42{
43}
44
49{
50}
51
58{
60
61 if (d->document == document)
62 return;
63
64 if (d->document)
65 disconnect(d->documentStatusChangedConnection);
66
67 d->document = document;
68 emit documentChanged(d->document);
69
70 if (d->document)
71 d->documentStatusChangedConnection =
72 connect(d->document.data(), &QPdfDocument::statusChanged, this,
73 [d](){ d->documentStatusChanged(); });
74
75 d->documentStatusChanged();
76}
77
79{
80 Q_D(const QPdfPageSelector);
81
82 return d->document;
83}
84
86{
87 Q_D(const QPdfPageSelector);
88 if (d->document.isNull())
89 return 0;
90
91 return d->document->pageIndexForLabel(text);
92}
93
95{
96 Q_D(const QPdfPageSelector);
97 if (d->document.isNull())
98 return {};
99
100 return d->document->pageLabel(value);
101}
102
104
105#include "moc_qpdfpageselector.cpp"
QString text
the spin box's text, including any prefix and suffix
The QPdfDocument class loads a PDF document and renders pages from it.
Status status
This property holds the current status of the document.
int pageCount
This property holds the number of pages in the loaded document or 0 if no document is loaded.
void statusChanged(QPdfDocument::Status status)
QPointer< QPdfDocument > document
QPdfPageSelectorPrivate(QPdfPageSelector *q)
\inmodule QtPdf
QPdfDocument * document
This property holds the document to be viewed.
void setDocument(QPdfDocument *document)
int valueFromText(const QString &text) const override
This virtual function is used by the spin box whenever it needs to interpret text entered by the user...
~QPdfPageSelector()
Destroys the page selector.
void documentChanged(QPdfDocument *document)
QString textFromValue(int value) const override
This virtual function is used by the spin box whenever it needs to display the given value.
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
Definition qpointer.h:67
The QSpinBox class provides a spin box widget.
Definition qspinbox.h:16
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
#define this
Definition dialogs.cpp:9
QString text
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
#define emit
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent