30QPdfPageSelector::QPdfPageSelector(QWidget *parent)
31 : QWidget(parent), d_ptr(
new QPdfPageSelectorPrivate)
33 Q_D(QPdfPageSelector);
34 d->spinBox =
new QPdfPageSelectorSpinBox(
this);
35 d->spinBox->setObjectName(u"_q_spinBox"_s);
36 auto vlay =
new QVBoxLayout(
this);
37 vlay->setContentsMargins({});
38 vlay->addWidget(d->spinBox);
40 connect(d->spinBox, &QPdfPageSelectorSpinBox::_q_documentChanged,
41 this, &QPdfPageSelector::documentChanged);
42 connect(d->spinBox, &QSpinBox::valueChanged,
this, &QPdfPageSelector::currentPageChanged);
43 connect(d->spinBox, &QSpinBox::textChanged,
this, &QPdfPageSelector::currentPageLabelChanged);
120 if (m_document == document)
124 disconnect(m_documentStatusChangedConnection);
126 m_document = document;
127 emit _q_documentChanged(document);
130 m_documentStatusChangedConnection =
131 connect(m_document.get(), &QPdfDocument::statusChanged,
132 this, &QPdfPageSelectorSpinBox::documentStatusChanged);
135 documentStatusChanged();
QValidator::State validate(QString &text, int &pos) const override
This virtual function is called by the QAbstractSpinBox to determine whether input is valid.
~QPdfPageSelectorSpinBox()
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...
void setDocument(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.