![]() |
Qt 6.x
The Qt SDK
|
The QPageRanges class represents a collection of page ranges. More...
#include <qpageranges.h>
Classes | |
struct | Range |
\inmodule QtGui More... | |
Public Member Functions | |
QPageRanges () | |
Constructs an empty QPageRanges object. | |
~QPageRanges () | |
Destroys the page ranges. | |
QPageRanges (const QPageRanges &other) noexcept | |
Constructs a QPageRanges object by copying other. | |
QPageRanges & | operator= (const QPageRanges &other) noexcept |
Assigns other to this QPageRanges object. | |
QPageRanges (QPageRanges &&other) noexcept=default | |
Constructs a QPageRanges object by moving from other. | |
void | swap (QPageRanges &other) noexcept |
void | addPage (int pageNumber) |
Adds the single page pageNumber to the ranges. | |
void | addRange (int from, int to) |
Adds the range specified with from and to to the ranges. | |
QList< Range > | toRangeList () const |
Returns a list with the values of the ranges. | |
void | clear () |
Removes all page ranges. | |
QString | toString () const |
Returns the string representation of the page ranges. | |
bool | contains (int pageNumber) const |
Returns true if the ranges include the page pageNumber; otherwise returns false . | |
bool | isEmpty () const |
Returns true if the ranges are empty; otherwise returns false . | |
int | firstPage () const |
Returns the index of the first page covered by the page ranges, or 0 if the page ranges are empty. | |
int | lastPage () const |
Returns the index of the last page covered by the page ranges, or 0 if the page ranges are empty. | |
void | detach () |
Static Public Member Functions | |
static QPageRanges | fromString (const QString &ranges) |
Constructs and returns a QPageRanges object populated with the ranges from the string representation. | |
Friends | |
bool | operator== (const QPageRanges &lhs, const QPageRanges &rhs) noexcept |
bool | operator!= (const QPageRanges &lhs, const QPageRanges &rhs) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
QDataStream & | operator<< (QDataStream &stream, const QPageRanges &pageRanges) |
Writes pageRanges to stream as a range string. | |
QDataStream & | operator>> (QDataStream &stream, QPageRanges &pageRanges) |
Reads a page ranges string from stream and stores it in pageRanges. | |
The QPageRanges class represents a collection of page ranges.
\inmodule QtGui
Use QPagedPaintDevice::pageRanges() to access the collection of page ranges associated with a paged device.
Definition at line 20 of file qpageranges.h.
|
default |
Constructs an empty QPageRanges object.
Referenced by fromString().
|
default |
Destroys the page ranges.
|
defaultnoexcept |
Constructs a QPageRanges object by copying other.
|
defaultnoexcept |
Constructs a QPageRanges object by moving from other.
void QPageRanges::addPage | ( | int | pageNumber | ) |
Adds the single page pageNumber to the ranges.
Definition at line 91 of file qpageranges.cpp.
References QList< T >::append(), detach(), QPageRangesPrivate::intervals, QPageRangesPrivate::mergeIntervals(), and qWarning.
void QPageRanges::addRange | ( | int | from, |
int | to | ||
) |
Adds the range specified with from and to to the ranges.
Definition at line 109 of file qpageranges.cpp.
References QList< T >::append(), detach(), QPageRangesPrivate::intervals, QPageRangesPrivate::mergeIntervals(), and qWarning.
Referenced by QPrinter::setFromTo().
void QPageRanges::clear | ( | ) |
Removes all page ranges.
Definition at line 136 of file qpageranges.cpp.
References QExplicitlySharedDataPointer< T >::reset().
Referenced by QPrinter::setFromTo().
bool QPageRanges::contains | ( | int | pageNumber | ) | const |
Returns true
if the ranges include the page pageNumber; otherwise returns false
.
Definition at line 230 of file qpageranges.cpp.
References QPageRangesPrivate::intervals.
Referenced by QTextDocument::print().
void QPageRanges::detach | ( | ) |
Definition at line 287 of file qpageranges.cpp.
References QExplicitlySharedDataPointer< T >::detach(), and QExplicitlySharedDataPointer< T >::reset().
Referenced by addPage(), and addRange().
int QPageRanges::firstPage | ( | ) | const |
Returns the index of the first page covered by the page ranges, or 0 if the page ranges are empty.
Definition at line 254 of file qpageranges.cpp.
References QList< T >::first(), QPageRanges::Range::from, QPageRangesPrivate::intervals, and isEmpty().
Referenced by QPrinter::fromPage(), and QTextDocument::print().
|
static |
Constructs and returns a QPageRanges object populated with the ranges from the string representation.
In case of parsing error, returns an empty QPageRanges object.
Definition at line 155 of file qpageranges.cpp.
References QPageRanges(), QList< T >::append(), QGraphicsItem::contains(), QPageRangesPrivate::intervals, item, items, QPageRangesPrivate::mergeIntervals(), number, ok, QExplicitlySharedDataPointer< T >::reset(), and QString::split().
Referenced by operator>>(), and QPrintDialogPrivate::setupPrinter().
bool QPageRanges::isEmpty | ( | ) | const |
Returns true
if the ranges are empty; otherwise returns false
.
Definition at line 245 of file qpageranges.cpp.
References QPageRangesPrivate::intervals, and QList< T >::isEmpty().
Referenced by firstPage(), lastPage(), QTextDocument::print(), and QPrintDialogPrivate::setupPrinter().
int QPageRanges::lastPage | ( | ) | const |
Returns the index of the last page covered by the page ranges, or 0 if the page ranges are empty.
Definition at line 265 of file qpageranges.cpp.
References QPageRangesPrivate::intervals, isEmpty(), QList< T >::last(), and QPageRanges::Range::to.
Referenced by QTextDocument::print(), and QPrinter::toPage().
|
defaultnoexcept |
Assigns other to this QPageRanges object.
Moves other into this QPageRanges object.
|
inlinenoexcept |
QList< QPageRanges::Range > QPageRanges::toRangeList | ( | ) | const |
Returns a list with the values of the ranges.
Definition at line 126 of file qpageranges.cpp.
References QPageRangesPrivate::intervals.
QString QPageRanges::toString | ( | ) | const |
Returns the string representation of the page ranges.
Definition at line 205 of file qpageranges.cpp.
References QPageRangesPrivate::intervals, QString::number(), and QStringLiteral.
Referenced by operator<<(), operator<<(), and QPrintDialogPrivate::setupPrinter().
|
friend |
Definition at line 36 of file qpageranges.h.
|
related |
Writes pageRanges to stream as a range string.
Definition at line 305 of file qpageranges.cpp.
References toString().
|
friend |
Definition at line 34 of file qpageranges.h.
|
related |
Reads a page ranges string from stream and stores it in pageRanges.
Definition at line 320 of file qpageranges.cpp.
References fromString().