Class: QgsScrollArea

A QScrollArea subclass with improved scrolling behavior.

QgsScrollArea should be used instead of QScrollArea widgets. In most cases the use is identical, however QgsScrollArea has extra logic to avoid wheel events changing child widget values when the mouse cursor is temporarily located over a child widget during a scroll event.

All QGIS code and plugins should use QgsScrollArea in place of QScrollArea.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsScrollArea

Base classes

QScrollArea

QAbstractScrollArea

QFrame

QWidget

QObject

QPaintDevice

Subclasses

QgsVScrollArea

QgsVScrollArea is a QScrollArea subclass which only displays a vertical scrollbar and fits the width to the contents.

Methods

hasScrolled

Returns True if a scroll recently occurred within the QScrollArea or its child viewport()

scrollOccurred

Should be called when a scroll occurs on with the QScrollArea itself or its child viewport().

setVerticalOnly

Sets whether the scroll area only applies vertical.

class qgis.gui.QgsScrollArea[source]

Bases: QScrollArea

__init__(parent: QWidget | None = None)

Constructor for QgsScrollArea.

Parameters:

parent (Optional[QWidget] = None)

hasScrolled(self) bool[source]

Returns True if a scroll recently occurred within the QScrollArea or its child viewport()

Return type:

bool

scrollOccurred(self)[source]

Should be called when a scroll occurs on with the QScrollArea itself or its child viewport().

setVerticalOnly(self, verticalOnly: bool)[source]

Sets whether the scroll area only applies vertical.

If set to True, then scroll area children will resize horizontally to match the width of the scroll area widget.

Added in version 3.8.

Parameters:

verticalOnly (bool)