- class QPageRanges¶
The
QPageRanges
class represents a collection of page ranges. More…Synopsis¶
Methods¶
def
__init__()
def
addPage()
def
addRange()
def
clear()
def
contains()
def
firstPage()
def
isEmpty()
def
lastPage()
def
__ne__()
def
__eq__()
def
swap()
def
toRangeList()
def
toString()
Static functions¶
def
fromString()
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.- __init__()¶
Constructs an empty
QPageRanges
object.- __init__(other)
- Parameters:
other –
QPageRanges
Constructs a
QPageRanges
object by copyingother
.- 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.
- addRange(from, to)¶
- Parameters:
from – int
to – int
Adds the range specified with
from
andto
to the ranges.Note
Page numbers start with 1. Attempts to add page numbers smaller than 1 will be ignored with a warning.
- clear()¶
Removes all page ranges.
- contains(pageNumber)¶
- Parameters:
pageNumber – int
- Return type:
bool
Returns
true
if the ranges include the pagepageNumber
; otherwise returnsfalse
.- 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 fromString(ranges)¶
- Parameters:
ranges – str
- Return type:
Constructs and returns a
QPageRanges
object populated with theranges
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()¶
- Return type:
bool
Returns
true
if the ranges are empty; otherwise returnsfalse
.- lastPage()¶
- Return type:
int
Returns the index of the last page covered by the page ranges, or 0 if the page ranges are empty.
- __ne__(rhs)¶
- Parameters:
rhs –
QPageRanges
- Return type:
bool
- __eq__(rhs)¶
- Parameters:
rhs –
QPageRanges
- Return type:
bool
- swap(other)¶
- Parameters:
other –
QPageRanges
- toRangeList()¶
- Return type:
.list of QPageRanges.Range
Returns a list with the values of the ranges.
- toString()¶
- Return type:
str
Returns the string representation of the page ranges.