QPageRanges Class
QPageRanges 类表示一组页面范围。更多内容...
| 头文件: | #include <QPageRanges> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
| 自: | Qt 6.0 |
- 所有成员列表(包括继承的成员)
- QPageRanges 属于绘图类、打印机和打印 API 以及隐式共享类。
公共类型
| struct | Range |
公共函数
| QPageRanges() | |
| QPageRanges(const QPageRanges &other) | |
| QPageRanges(QPageRanges &&other) | |
| ~QPageRanges() | |
| void | addPage(int pageNumber) |
| void | addRange(int from, int to) |
| void | clear() |
| bool | contains(int pageNumber) const |
| int | firstPage() const |
| bool | isEmpty() const |
| int | lastPage() const |
| QList<QPageRanges::Range> | toRangeList() const |
| QString | toString() const |
| QPageRanges & | operator=(QPageRanges &&other) |
| QPageRanges & | operator=(const QPageRanges &other) |
静态公共成员
| QPageRanges | fromString(const QString &ranges) |
相关的非成员
| QDataStream & | operator<<(QDataStream &stream, const QPageRanges &pageRanges) |
| QDataStream & | operator>>(QDataStream &stream, QPageRanges &pageRanges) |
详细说明
使用QPagedPaintDevice::pageRanges() 访问与分页设备关联的页面范围集合。
成员函数文档
QPageRanges::QPageRanges()
创建一个空的 QPageRanges 对象。
[noexcept] QPageRanges::QPageRanges(const QPageRanges &other)
通过复制other 来构建一个QPageRanges对象。
[constexpr noexcept default] QPageRanges::QPageRanges(QPageRanges &&other)
通过从other 开始,构建一个QPageRanges对象。
[noexcept] QPageRanges::~QPageRanges()
删除这些页码范围。
void QPageRanges::addPage(int pageNumber)
将单页pageNumber 添加到范围中。
注意:页码 从 1 开始。尝试添加小于 1 的页码将被忽略,并显示警告。
void QPageRanges::addRange(int from, int to)
将通过from 和to 指定的范围添加到范围列表中。
注意:页码 从 1 开始。尝试添加小于 1 的页码将被忽略,并显示警告。
void QPageRanges::clear()
删除所有页面范围。
bool QPageRanges::contains(int pageNumber) const
如果范围包含页面pageNumber ,则返回true ;否则返回false 。
int QPageRanges::firstPage() const
返回页面范围所涵盖的首页索引;如果页面范围为空,则返回 0。
[static] QPageRanges QPageRanges::fromString(const QString &ranges)
构建并返回一个QPageRanges 对象,该对象通过字符串表示形式填充了ranges 数据。
QPrinter printer;
QPageRanges ranges = QPageRanges::fromString("1-3,6-7");
printer.setPageRanges(ranges);如果解析出错,则返回一个空的QPageRanges 对象。
另请参阅 isEmpty()。
bool QPageRanges::isEmpty() const
如果范围为空,则返回true ;否则返回false 。
int QPageRanges::lastPage() const
返回页面范围所涵盖的最后一个页面的索引;如果页面范围为空,则返回 0。
QList<QPageRanges::Range> QPageRanges::toRangeList() const
返回一个包含这些范围值的列表。
QString QPageRanges::toString() const
返回页面范围的字符串表示形式。
[noexcept] QPageRanges &QPageRanges::operator=(QPageRanges &&other)
将other 移动到此QPageRanges 对象中。
[noexcept] QPageRanges &QPageRanges::operator=(const QPageRanges &other)
将 `other ` 赋值给此 `QPageRanges ` 对象。
相关的非成员
QDataStream &operator<<(QDataStream &stream, const QPageRanges &pageRanges)
将pageRanges 作为范围字符串写入stream 。
另请参阅 QPageRanges::toString 。
QDataStream &operator>>(QDataStream &stream, QPageRanges &pageRanges)
从stream 读取页面范围字符串,并将其存储在pageRanges 中。
另请参阅 QPageRanges::fromString 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.