QRangeCollection Class
The QRangeCollection class represents a collection of decimal intervals. More...
Header: | #include <QRangeCollection> |
CMake: | find_package(Qt6 COMPONENT Gui) target_link_libraries(mytarget PUBLIC Qt::Gui) |
qmake: | QT += gui |
Since: | Qt 6.0 |
Public Functions
~QRangeCollection() | |
void | addPage(int pageNumber) |
void | addRange(int from, int to) |
void | clear() |
bool | contains(const int pageNumber) const |
int | firstPage() const |
bool | isEmpty() const |
int | lastPage() const |
bool | parse(const QString &ranges) |
QList<QPair<int, int> > | toList() const |
QString | toString() const |
Detailed Description
QRangeCollection manages a set of decimal intervals.
Use QPrinter::rangeCollection() to access the collection of page ranges associated with a QPrinter.
Member Function Documentation
QRangeCollection::~QRangeCollection()
Destroys the collection.
void QRangeCollection::addPage(int pageNumber)
Inserts a single number pageNumber into the collection.
void QRangeCollection::addRange(int from, int to)
Inserts a range specified with from and to into the collection.
void QRangeCollection::clear()
Removes all ranges from this collection.
bool QRangeCollection::contains(const int pageNumber) const
Returns true
if the collection contains an occurrence or a bounding range of pageNumber; otherwise returns false
.
int QRangeCollection::firstPage() const
Returns the index of the first page covered by the range collection.
bool QRangeCollection::isEmpty() const
Returns true
if the collection is empty; otherwise returns false
.
int QRangeCollection::lastPage() const
Returns the index of the last page covered by the range collection.
bool QRangeCollection::parse(const QString &ranges)
Constructs the range collection from a string representation of ranges.
QPrinter printer; printer->rangeCollection()->parse("1-3,6-7");
Returns true
on success.
QList<QPair<int, int> > QRangeCollection::toList() const
Returns a list with the values of the ranges used in this collection.
QString QRangeCollection::toString() const
Returns the string representation of the ranges in the collection.