QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
QgsCollapsibleGroupBoxBasic Class Reference

A groupbox that collapses/expands when toggled. More...

#include <qgscollapsiblegroupbox.h>

Inheritance diagram for QgsCollapsibleGroupBoxBasic:
Inheritance graph
[legend]

Public Slots

void checkClicked (bool ckd)
 
void checkToggled (bool ckd)
 
void setStyleSheet (const QString &style)
 Overridden to prepare base call and avoid crash due to specific QT versions. More...
 
void toggleCollapsed ()
 

Signals

void collapsedStateChanged (bool collapsed)
 Signal emitted when groupbox collapsed/expanded state is changed, and when first shown. More...
 

Public Member Functions

 QgsCollapsibleGroupBoxBasic (const QString &title, QWidget *parent=nullptr)
 
 QgsCollapsibleGroupBoxBasic (QWidget *parent=nullptr)
 
bool isCollapsed () const
 Returns the current collapsed state of this group box. More...
 
bool scrollOnExpand ()
 If this is set to false the parent QScrollArea will not be automatically scrolled to this widget's contents when expanded. More...
 
void setCollapsed (bool collapse)
 Collapse or uncollapse this groupbox. More...
 
void setScrollOnExpand (bool scroll)
 Sets this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded. More...
 
void setSyncGroup (const QString &grp)
 Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key. More...
 
QString syncGroup () const
 Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key. More...
 

Protected Member Functions

void changeEvent (QEvent *event) override
 
void clearModifiers ()
 
void collapseExpandFixes ()
 Visual fixes for when group box is collapsed/expanded. More...
 
void init ()
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void showEvent (QShowEvent *event) override
 
QRect titleRect () const
 
void updateStyle ()
 

Protected Attributes

bool mAltDown
 
QgsGroupBoxCollapseButtonmCollapseButton = nullptr
 
bool mCollapsed
 
QIcon mCollapseIcon
 
QIcon mExpandIcon
 
bool mInitFlat
 
bool mInitFlatChecked
 
QScrollArea * mParentScrollArea = nullptr
 
bool mScrollOnExpand
 
bool mShiftDown
 
bool mShown
 
QString mSyncGroup
 
QWidget * mSyncParent = nullptr
 
bool mTitleClicked
 

Properties

bool collapsed
 The collapsed state of this group box. More...
 
bool scrollOnExpand
 If this property is set to true, a parent scroll area will try to make sure that the whole group box is visible when uncollapsing it. More...
 
QString syncGroup
 An optional group to be collapsed and uncollapsed in sync with this group box if the Alt-modifier is pressed while collapsing / uncollapsing. More...
 

Detailed Description

A groupbox that collapses/expands when toggled.

Basic class QgsCollapsibleGroupBoxBasic does not auto-save collapsed or checked state Holding Alt modifier key when toggling collapsed state will synchronize the toggling across other collapsible group boxes with the same syncGroup QString value Holding Shift modifier key when attempting to toggle collapsed state will expand current group box, then collapse any others with the same syncGroup QString 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, QString syncGroup, bool scrollOnExpand

Definition at line 71 of file qgscollapsiblegroupbox.h.

Constructor & Destructor Documentation

◆ QgsCollapsibleGroupBoxBasic() [1/2]

QgsCollapsibleGroupBoxBasic::QgsCollapsibleGroupBoxBasic ( QWidget *  parent = nullptr)

Definition at line 31 of file qgscollapsiblegroupbox.cpp.

◆ QgsCollapsibleGroupBoxBasic() [2/2]

QgsCollapsibleGroupBoxBasic::QgsCollapsibleGroupBoxBasic ( const QString &  title,
QWidget *  parent = nullptr 
)

Definition at line 37 of file qgscollapsiblegroupbox.cpp.

Member Function Documentation

◆ changeEvent()

void QgsCollapsibleGroupBoxBasic::changeEvent ( QEvent *  event)
overrideprotected

Definition at line 169 of file qgscollapsiblegroupbox.cpp.

◆ checkClicked

void QgsCollapsibleGroupBoxBasic::checkClicked ( bool  ckd)
slot

Definition at line 214 of file qgscollapsiblegroupbox.cpp.

◆ checkToggled

void QgsCollapsibleGroupBoxBasic::checkToggled ( bool  ckd)
slot

Definition at line 208 of file qgscollapsiblegroupbox.cpp.

◆ clearModifiers()

void QgsCollapsibleGroupBoxBasic::clearModifiers ( )
protected

Definition at line 200 of file qgscollapsiblegroupbox.cpp.

◆ collapsedStateChanged

void QgsCollapsibleGroupBoxBasic::collapsedStateChanged ( bool  collapsed)
signal

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

◆ collapseExpandFixes()

void QgsCollapsibleGroupBoxBasic::collapseExpandFixes ( )
protected

Visual fixes for when group box is collapsed/expanded.

Definition at line 451 of file qgscollapsiblegroupbox.cpp.

◆ init()

void QgsCollapsibleGroupBoxBasic::init ( )
protected

Definition at line 44 of file qgscollapsiblegroupbox.cpp.

◆ isCollapsed()

bool QgsCollapsibleGroupBoxBasic::isCollapsed ( ) const
inline

Returns the current collapsed state of this group box.

Definition at line 100 of file qgscollapsiblegroupbox.h.

◆ mousePressEvent()

void QgsCollapsibleGroupBoxBasic::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 134 of file qgscollapsiblegroupbox.cpp.

◆ mouseReleaseEvent()

void QgsCollapsibleGroupBoxBasic::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 149 of file qgscollapsiblegroupbox.cpp.

◆ scrollOnExpand()

bool QgsCollapsibleGroupBoxBasic::scrollOnExpand ( )
inline

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

Definition at line 123 of file qgscollapsiblegroupbox.h.

◆ setCollapsed()

void QgsCollapsibleGroupBoxBasic::setCollapsed ( bool  collapse)

Collapse or uncollapse this groupbox.

Parameters
collapseWill collapse on true and uncollapse on false

Definition at line 408 of file qgscollapsiblegroupbox.cpp.

◆ setScrollOnExpand()

void QgsCollapsibleGroupBoxBasic::setScrollOnExpand ( bool  scroll)
inline

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

Definition at line 120 of file qgscollapsiblegroupbox.h.

◆ setStyleSheet

void QgsCollapsibleGroupBoxBasic::setStyleSheet ( const QString &  style)
slot

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

Since
QGIS 3.16

Definition at line 303 of file qgscollapsiblegroupbox.cpp.

◆ setSyncGroup()

void QgsCollapsibleGroupBoxBasic::setSyncGroup ( const QString &  grp)

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

Definition at line 181 of file qgscollapsiblegroupbox.cpp.

◆ showEvent()

void QgsCollapsibleGroupBoxBasic::showEvent ( QShowEvent *  event)
overrideprotected

Definition at line 82 of file qgscollapsiblegroupbox.cpp.

◆ syncGroup()

QString QgsCollapsibleGroupBoxBasic::syncGroup ( ) const
inline

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

Definition at line 112 of file qgscollapsiblegroupbox.h.

◆ titleRect()

QRect QgsCollapsibleGroupBoxBasic::titleRect ( ) const
protected

Definition at line 192 of file qgscollapsiblegroupbox.cpp.

◆ toggleCollapsed

void QgsCollapsibleGroupBoxBasic::toggleCollapsed ( )
slot

Definition at line 226 of file qgscollapsiblegroupbox.cpp.

◆ updateStyle()

void QgsCollapsibleGroupBoxBasic::updateStyle ( )
protected

Definition at line 312 of file qgscollapsiblegroupbox.cpp.

Member Data Documentation

◆ mAltDown

bool QgsCollapsibleGroupBoxBasic::mAltDown
protected

Definition at line 165 of file qgscollapsiblegroupbox.h.

◆ mCollapseButton

QgsGroupBoxCollapseButton* QgsCollapsibleGroupBoxBasic::mCollapseButton = nullptr
protected

Definition at line 162 of file qgscollapsiblegroupbox.h.

◆ mCollapsed

bool QgsCollapsibleGroupBoxBasic::mCollapsed
protected

Definition at line 156 of file qgscollapsiblegroupbox.h.

◆ mCollapseIcon

QIcon QgsCollapsibleGroupBoxBasic::mCollapseIcon
protected

Definition at line 169 of file qgscollapsiblegroupbox.h.

◆ mExpandIcon

QIcon QgsCollapsibleGroupBoxBasic::mExpandIcon
protected

Definition at line 170 of file qgscollapsiblegroupbox.h.

◆ mInitFlat

bool QgsCollapsibleGroupBoxBasic::mInitFlat
protected

Definition at line 157 of file qgscollapsiblegroupbox.h.

◆ mInitFlatChecked

bool QgsCollapsibleGroupBoxBasic::mInitFlatChecked
protected

Definition at line 158 of file qgscollapsiblegroupbox.h.

◆ mParentScrollArea

QScrollArea* QgsCollapsibleGroupBoxBasic::mParentScrollArea = nullptr
protected

Definition at line 161 of file qgscollapsiblegroupbox.h.

◆ mScrollOnExpand

bool QgsCollapsibleGroupBoxBasic::mScrollOnExpand
protected

Definition at line 159 of file qgscollapsiblegroupbox.h.

◆ mShiftDown

bool QgsCollapsibleGroupBoxBasic::mShiftDown
protected

Definition at line 166 of file qgscollapsiblegroupbox.h.

◆ mShown

bool QgsCollapsibleGroupBoxBasic::mShown
protected

Definition at line 160 of file qgscollapsiblegroupbox.h.

◆ mSyncGroup

QString QgsCollapsibleGroupBoxBasic::mSyncGroup
protected

Definition at line 164 of file qgscollapsiblegroupbox.h.

◆ mSyncParent

QWidget* QgsCollapsibleGroupBoxBasic::mSyncParent = nullptr
protected

Definition at line 163 of file qgscollapsiblegroupbox.h.

◆ mTitleClicked

bool QgsCollapsibleGroupBoxBasic::mTitleClicked
protected

Definition at line 167 of file qgscollapsiblegroupbox.h.

Property Documentation

◆ collapsed

bool QgsCollapsibleGroupBoxBasic::collapsed
readwrite

The collapsed state of this group box.

If it is set to true, all content is hidden if it is set to false all content is shown.

Definition at line 57 of file qgscollapsiblegroupbox.h.

◆ scrollOnExpand

bool QgsCollapsibleGroupBoxBasic::scrollOnExpand
readwrite

If this property is set to true, a parent scroll area will try to make sure that the whole group box is visible when uncollapsing it.

Definition at line 57 of file qgscollapsiblegroupbox.h.

◆ syncGroup

QString QgsCollapsibleGroupBoxBasic::syncGroup
readwrite

An optional group to be collapsed and uncollapsed in sync with this group box if the Alt-modifier is pressed while collapsing / uncollapsing.

Definition at line 57 of file qgscollapsiblegroupbox.h.


The documentation for this class was generated from the following files: