(self, widget: QWidget)
Reimplemented
Reimplemented
Reimplemented
def setupViewport(self, widget: QWidget) -> None:
        """Reimplemented"""
        super().setupViewport(widget)
        sp = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        header = _HeaderGraphicsView(
            objectName="sticky-header-view", sizePolicy=sp,
            verticalScrollBarPolicy=Qt.ScrollBarAlwaysOff,
            horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff,
            alignment=self.alignment()
        )
        header.setFocusProxy(self)
        header.viewport().installEventFilter(self)
        header.setFrameStyle(QGraphicsView.NoFrame)

        footer = _HeaderGraphicsView(
            objectName="sticky-footer-view", sizePolicy=sp,
            verticalScrollBarPolicy=Qt.ScrollBarAlwaysOff,
            horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff,
            alignment=self.alignment()
        )
        footer.setFocusProxy(self)
        footer.viewport().installEventFilter(self)
        footer.setFrameStyle(QGraphicsView.NoFrame)

        over = _OverlayWidget(
            widget, objectName="sticky-header-overlay-container",
            alignment=Qt.AlignTop,
            sizePolicy=sp,
            visible=False,
        )
        over.setLayout(QVBoxLayout(margin=0))
        over.layout().addWidget(header)
        over.setWidget(widget)

        over = _OverlayWidget(
            widget, objectName="sticky-footer-overlay-container",
            alignment=Qt.AlignBottom,
            sizePolicy=sp,
            visible=False
        )
        over.setLayout(QVBoxLayout(margin=0))
        over.layout().addWidget(footer)
        over.setWidget(widget)

        def bind(source: QScrollBar, target: QScrollBar) -> None:
            # bind target scroll bar to `source` (range and value).
            target.setRange(source.minimum(), source.maximum())
            target.setValue(source.value())
            source.rangeChanged.connect(target.setRange)
            source.valueChanged.connect(target.setValue)

        hbar = self.horizontalScrollBar()
        footer_hbar = footer.horizontalScrollBar()
        header_hbar = header.horizontalScrollBar()

        bind(hbar, footer_hbar)
        bind(hbar, header_hbar)

        self.__headerView = header
        self.__footerView = footer
        self.__updateView(header, self.__footerRect)
        self.__updateView(footer, self.__footerRect)
def setupViewport ( self , widget : QWidget ) -> None : super ( ) . setupViewport ( widget ) sp = QSizePolicy ( QSizePolicy . Expanding , QSizePolicy . Fixed ) header = _HeaderGraphicsView ( objectName = "sticky-header-view" , sizePolicy = sp , verticalScrollBarPolicy = Qt . ScrollBarAlwaysOff , horizontalScrollBarPolicy = Qt . ScrollBarAlwaysOff , alignment = self . alignment ( ) ) header . setFocusProxy ( self ) header . viewport ( ) . installEventFilter ( self ) header . setFrameStyle ( QGraphicsView . NoFrame ) footer = _HeaderGraphicsView ( objectName = "sticky-footer-view" , sizePolicy = sp , verticalScrollBarPolicy = Qt . ScrollBarAlwaysOff , horizontalScrollBarPolicy = Qt . ScrollBarAlwaysOff , alignment = self . alignment ( ) ) footer . setFocusProxy ( self ) footer . viewport ( ) . installEventFilter ( self ) footer . setFrameStyle ( QGraphicsView . NoFrame ) over = _OverlayWidget ( widget , objectName = "sticky-header-overlay-container" , alignment = Qt . AlignTop , sizePolicy = sp , visible = False , ) over . setLayout ( QVBoxLayout ( margin = 0 ) ) over . layout ( ) . addWidget ( header ) over . setWidget ( widget ) over = _OverlayWidget ( widget , objectName = "sticky-footer-overlay-container" , alignment = Qt . AlignBottom , sizePolicy = sp , visible = False ) over . setLayout ( QVBoxLayout ( margin = 0 ) ) over . layout ( ) . addWidget ( footer ) over . setWidget ( widget ) def bind ( source : QScrollBar , target : QScrollBar ) -> None : # bind target scroll bar to `source` (range and value). target . setRange ( source . minimum ( ) , source . maximum ( ) ) target . setValue ( source . value ( ) ) source . rangeChanged . connect ( target . setRange ) source . valueChanged . connect ( target . setValue ) hbar = self . horizontalScrollBar ( ) footer_hbar = footer . horizontalScrollBar ( ) header_hbar = header . horizontalScrollBar ( ) bind ( hbar , footer_hbar ) bind ( hbar , header_hbar ) self . __headerView = header self . __footerView = footer self . __updateView ( header , self . __footerRect ) self . __updateView ( footer , self . __footerRect )