Skip to content

PageRanges

Qt Base Class: QPageRanges

Signature: QPageRanges(self) -> None QPageRanges(self, other: PySide6.QtGui.QPageRanges) -> None

Base classes

Name Children Inherits
QPageRanges
PySide6.QtGui
QPageRanges(self) -> None

⋔ Inheritance diagram

graph TD
  1473245522128["gui.PageRanges"]
  1473300096032["QtGui.QPageRanges"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473300096032 --> 1473245522128
  1473291690208 --> 1473300096032
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QPageRanges

Represents a collection of page ranges.

Source code in prettyqt\gui\pageranges.py
class PageRanges(QtGui.QPageRanges):
    """Represents a collection of page ranges."""

    def __bool__(self):
        return not self.isEmpty()

    def __getitem__(self, index: int):
        return self.get_range_list()[index]

    def __str__(self):
        return self.toString()

    def __repr__(self):
        return get_repr(self, self.get_range_list())

    def __contains__(self, other: int):
        return self.contains(other)

    def __add__(self, other: int | tuple[int, int]):
        if isinstance(other, int):
            self.addPage(other)
        else:
            self.addRange(*other)
        return self

    def __len__(self):
        return self.lastPage() - self.firstPage()

    def get_range_list(self) -> list[tuple[int, int]]:
        return [(i.from_, i.to) for i in self.toRangeList()]