Class: QgsScrollArea

class qgis.gui.QgsScrollArea(parent: QWidget = None)

Bases: PyQt5.QtWidgets.QScrollArea

Constructor for 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.

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hasScrolled(self) bool

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

Return type


hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, event: QResizeEvent)

event (QResizeEvent) –

QgsScrollArea.scrollContentsBy(self, int, int)

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

sender(self) QObject
senderSignalIndex(self) int
setVerticalOnly(self, verticalOnly: bool)

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.

New in version 3.8.


verticalOnly (bool) –

QgsScrollArea.setViewportMargins(self, int, int, int, int)
setViewportMargins(self, QMargins) None
sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
viewportEvent(self, QEvent) bool
viewportMargins(self) QMargins
viewportSizeHint(self) QSize
wheelEvent(self, event: QWheelEvent)

event (QWheelEvent) –