QPageRanges#

The QPageRanges class represents a collection of page ranges. More

Inheritance diagram of PySide6.QtGui.QPageRanges

Synopsis#

Functions#

Static functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Use pageRanges() to access the collection of page ranges associated with a paged device.

class PySide6.QtGui.QPageRanges#

PySide6.QtGui.QPageRanges(other)

Parameters:

otherPySide6.QtGui.QPageRanges

Constructs an empty QPageRanges object.

Constructs a QPageRanges object by copying other.

PySide6.QtGui.QPageRanges.addPage(pageNumber)#
Parameters:

pageNumber – int

Adds the single page pageNumber to the ranges.

Note

Page numbers start with 1. Attempts to add page numbers smaller than 1 will be ignored with a warning.

PySide6.QtGui.QPageRanges.addRange(from, to)#
Parameters:
  • from – int

  • to – int

Adds the range specified with from and to to the ranges.

Note

Page numbers start with 1. Attempts to add page numbers smaller than 1 will be ignored with a warning.

PySide6.QtGui.QPageRanges.clear()#

Removes all page ranges.

PySide6.QtGui.QPageRanges.contains(pageNumber)#
Parameters:

pageNumber – int

Return type:

bool

Returns true if the ranges include the page pageNumber; otherwise returns false.

PySide6.QtGui.QPageRanges.firstPage()#
Return type:

int

Returns the index of the first page covered by the page ranges, or 0 if the page ranges are empty.

static PySide6.QtGui.QPageRanges.fromString(ranges)#
Parameters:

ranges – str

Return type:

PySide6.QtGui.QPageRanges

Constructs and returns a QPageRanges object populated with the ranges from the string representation.

QPrinter printer;
QPageRanges ranges = QPageRanges::fromString("1-3,6-7");
printer.setPageRanges(ranges);

In case of parsing error, returns an empty QPageRanges object.

See also

isEmpty()

PySide6.QtGui.QPageRanges.isEmpty()#
Return type:

bool

Returns true if the ranges are empty; otherwise returns false.

PySide6.QtGui.QPageRanges.lastPage()#
Return type:

int

Returns the index of the last page covered by the page ranges, or 0 if the page ranges are empty.

PySide6.QtGui.QPageRanges.__ne__(rhs)#
Parameters:

rhsPySide6.QtGui.QPageRanges

Return type:

bool

PySide6.QtGui.QPageRanges.__eq__(rhs)#
Parameters:

rhsPySide6.QtGui.QPageRanges

Return type:

bool

PySide6.QtGui.QPageRanges.swap(other)#
Parameters:

otherPySide6.QtGui.QPageRanges

PySide6.QtGui.QPageRanges.toRangeList()#

Returns a list with the values of the ranges.

PySide6.QtGui.QPageRanges.toString()#
Return type:

str

Returns the string representation of the page ranges.