Class: QgsCollapsibleGroupBoxBasic

A groupbox that collapses/expands when toggled.

The basic class QgsCollapsibleGroupBoxBasic does not auto-save collapsed or checked states.

Holding Alt modifier key when toggling collapsed state will synchronize the toggling across other collapsible group boxes with the same syncGroup string value.

Holding Shift modifier key when attempting to toggle collapsed state will expand current group box, then collapse any others with the same syncGroup string value.

Note

To add Collapsible properties in promoted QtDesigner widgets, you can add the following “Dynamic properties” by clicking on the green + in the propreties palette: bool collapsed, string syncGroup, bool scrollOnExpand

Class Hierarchy

Inheritance diagram of qgis.gui.QgsCollapsibleGroupBoxBasic

Base classes

QGroupBox

QWidget

QObject

QPaintDevice

Subclasses

QgsCollapsibleGroupBox

A groupbox that collapses/expands when toggled and can save its collapsed and checked states.

Methods

checkClicked

checkToggled

clearModifiers

collapseExpandFixes

Visual fixes for when group box is collapsed/expanded

isCollapsed

Returns the current collapsed state of this group box

scrollOnExpand

If this is set to False the parent QScrollArea will not be automatically scrolled to this widget's contents when expanded

setCollapsed

Collapse or uncollapse this groupbox

setScrollOnExpand

Sets this to False to not automatically scroll parent QScrollArea to this widget's contents when expanded

setStyleSheet

Overridden to prepare base call and avoid crash due to specific QT versions

setSyncGroup

Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key

syncGroup

Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key

titleRect

toggleCollapsed

updateStyle

Signals

collapsedStateChanged

Signal emitted when groupbox collapsed/expanded state is changed, and when first shown

class qgis.gui.QgsCollapsibleGroupBoxBasic[source]

Bases: QGroupBox

checkClicked(self, ckd: bool)[source]
Parameters:

ckd (bool)

checkToggled(self, ckd: bool)[source]
Parameters:

ckd (bool)

clearModifiers(self)[source]
collapseExpandFixes(self)[source]

Visual fixes for when group box is collapsed/expanded

signal collapsedStateChanged(collapsed: bool)[source]

Signal emitted when groupbox collapsed/expanded state is changed, and when first shown

Parameters:

collapsed (bool)

isCollapsed(self) bool[source]

Returns the current collapsed state of this group box

Return type:

bool

scrollOnExpand(self) bool[source]

If this is set to False the parent QScrollArea will not be automatically scrolled to this widget’s contents when expanded

Return type:

bool

setCollapsed(self, collapse: bool)[source]

Collapse or uncollapse this groupbox

Parameters:

collapse (bool) – Will collapse on True and uncollapse on False

setScrollOnExpand(self, scroll: bool)[source]

Sets this to False to not automatically scroll parent QScrollArea to this widget’s contents when expanded

Parameters:

scroll (bool)

setStyleSheet(self, style: str | None)[source]

Overridden to prepare base call and avoid crash due to specific QT versions

Added in version 3.16.

Parameters:

style (Optional[str])

setSyncGroup(self, grp: str | None)[source]

Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key

Parameters:

grp (Optional[str])

syncGroup(self) str[source]

Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key

Return type:

str

titleRect(self) QRect[source]
Return type:

QRect

toggleCollapsed(self)[source]
updateStyle(self)[source]