QGIS API Documentation  2.99.0-Master (6a61179)
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
QgsCollapsibleGroupBox Class Reference

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

#include <qgscollapsiblegroupbox.h>

Inheritance diagram for QgsCollapsibleGroupBox:
Inheritance graph
[legend]

Public Member Functions

 QgsCollapsibleGroupBox (QWidget *parent=nullptr, QSettings *settings=nullptr)
 
 QgsCollapsibleGroupBox (const QString &title, QWidget *parent=nullptr, QSettings *settings=nullptr)
 
 ~QgsCollapsibleGroupBox ()
 
bool saveCheckedState ()
 
bool saveCollapsedState ()
 
void setSaveCheckedState (bool save)
 Set this to true to save/restore checked state. More...
 
void setSaveCollapsedState (bool save)
 set this to false to not save/restore collapsed state More...
 
void setSettingGroup (const QString &group)
 Set this to a defined string to share save/restore states across different parent dialogs. More...
 
void setSettings (QSettings *settings)
 
QString settingGroup () const
 Returns the name of the setting group in which the collapsed state will be saved. More...
 
- Public Member Functions inherited from QgsCollapsibleGroupBoxBasic
 QgsCollapsibleGroupBoxBasic (QWidget *parent=nullptr)
 
 QgsCollapsibleGroupBoxBasic (const QString &title, QWidget *parent=nullptr)
 
 ~QgsCollapsibleGroupBoxBasic ()
 
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)
 Set 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 Slots

void loadState ()
 Will load the collapsed and checked state. More...
 
void saveState () const
 Will save the collapsed and checked state. More...
 

Protected Member Functions

void init ()
 
QString saveKey () const
 
void showEvent (QShowEvent *event) override
 
- Protected Member Functions inherited from QgsCollapsibleGroupBoxBasic
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 mDelSettings
 
bool mSaveCheckedState
 
bool mSaveCollapsedState
 
QString mSettingGroup
 
QPointer< QSettings > mSettings
 
- Protected Attributes inherited from QgsCollapsibleGroupBoxBasic
bool mAltDown
 
QgsGroupBoxCollapseButtonmCollapseButton
 
bool mCollapsed
 
QIcon mCollapseIcon
 
QIcon mExpandIcon
 
bool mInitFlat
 
bool mInitFlatChecked
 
QScrollArea * mParentScrollArea
 
bool mScrollOnExpand
 
bool mShiftDown
 
bool mShown
 
QString mSyncGroup
 
QWidget * mSyncParent
 
bool mTitleClicked
 

Properties

bool saveCheckedState
 Shall the checked state of this group box be saved and loaded persistently in QSettings. More...
 
bool saveCollapsedState
 Shall the collapsed state of this group box be saved and loaded persistently in QSettings. More...
 
- Properties inherited from QgsCollapsibleGroupBoxBasic
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...
 

Additional Inherited Members

- Public Slots inherited from QgsCollapsibleGroupBoxBasic
void checkClicked (bool ckd)
 
void checkToggled (bool ckd)
 
void toggleCollapsed ()
 
- Signals inherited from QgsCollapsibleGroupBoxBasic
void collapsedStateChanged (bool collapsed)
 Signal emitted when groupbox collapsed/expanded state is changed, and when first shown. More...
 

Detailed Description

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

By default, it auto-saves only its collapsed state to the global settings based on the widget and it's parent names. 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

See also
basic class QgsCollapsibleGroupBoxBasic which does not auto-save states
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, bool saveCollapsedState, bool saveCheckedState, QString syncGroup

Definition at line 182 of file qgscollapsiblegroupbox.h.

Constructor & Destructor Documentation

§ QgsCollapsibleGroupBox() [1/2]

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox ( QWidget *  parent = nullptr,
QSettings *  settings = nullptr 
)

Definition at line 477 of file qgscollapsiblegroupbox.cpp.

§ QgsCollapsibleGroupBox() [2/2]

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox ( const QString &  title,
QWidget *  parent = nullptr,
QSettings *  settings = nullptr 
)

Definition at line 484 of file qgscollapsiblegroupbox.cpp.

§ ~QgsCollapsibleGroupBox()

QgsCollapsibleGroupBox::~QgsCollapsibleGroupBox ( )

Definition at line 492 of file qgscollapsiblegroupbox.cpp.

Member Function Documentation

§ init()

void QgsCollapsibleGroupBox::init ( )
protected

Definition at line 509 of file qgscollapsiblegroupbox.cpp.

§ loadState

void QgsCollapsibleGroupBox::loadState ( )
protectedslot

Will load the collapsed and checked state.

The configuration path from which it is loaded is defined by

  • The object name
  • The settingGroup

Definition at line 572 of file qgscollapsiblegroupbox.cpp.

§ saveCheckedState()

bool QgsCollapsibleGroupBox::saveCheckedState ( )
inline

Definition at line 212 of file qgscollapsiblegroupbox.h.

§ saveCollapsedState()

bool QgsCollapsibleGroupBox::saveCollapsedState ( )
inline

Definition at line 211 of file qgscollapsiblegroupbox.h.

§ saveKey()

QString QgsCollapsibleGroupBox::saveKey ( ) const
protected

Definition at line 550 of file qgscollapsiblegroupbox.cpp.

§ saveState

void QgsCollapsibleGroupBox::saveState ( ) const
protectedslot

Will save the collapsed and checked state.

The configuration path to which it is saved is defined by

  • The object name
  • The settingGroup

Definition at line 602 of file qgscollapsiblegroupbox.cpp.

§ setSaveCheckedState()

void QgsCollapsibleGroupBox::setSaveCheckedState ( bool  save)
inline

Set this to true to save/restore checked state.

Note
only turn on mSaveCheckedState for groupboxes NOT used in multiple places or used as options for different parent objects

Definition at line 210 of file qgscollapsiblegroupbox.h.

§ setSaveCollapsedState()

void QgsCollapsibleGroupBox::setSaveCollapsedState ( bool  save)
inline

set this to false to not save/restore collapsed state

Definition at line 205 of file qgscollapsiblegroupbox.h.

§ setSettingGroup()

void QgsCollapsibleGroupBox::setSettingGroup ( const QString &  group)
inline

Set this to a defined string to share save/restore states across different parent dialogs.

Definition at line 215 of file qgscollapsiblegroupbox.h.

§ setSettings()

void QgsCollapsibleGroupBox::setSettings ( QSettings *  settings)

Definition at line 500 of file qgscollapsiblegroupbox.cpp.

§ settingGroup()

QString QgsCollapsibleGroupBox::settingGroup ( ) const
inline

Returns the name of the setting group in which the collapsed state will be saved.

Definition at line 217 of file qgscollapsiblegroupbox.h.

§ showEvent()

void QgsCollapsibleGroupBox::showEvent ( QShowEvent *  event)
overrideprotected

Definition at line 529 of file qgscollapsiblegroupbox.cpp.

Member Data Documentation

§ mDelSettings

bool QgsCollapsibleGroupBox::mDelSettings
protected

Definition at line 247 of file qgscollapsiblegroupbox.h.

§ mSaveCheckedState

bool QgsCollapsibleGroupBox::mSaveCheckedState
protected

Definition at line 250 of file qgscollapsiblegroupbox.h.

§ mSaveCollapsedState

bool QgsCollapsibleGroupBox::mSaveCollapsedState
protected

Definition at line 249 of file qgscollapsiblegroupbox.h.

§ mSettingGroup

QString QgsCollapsibleGroupBox::mSettingGroup
protected

Definition at line 251 of file qgscollapsiblegroupbox.h.

§ mSettings

QPointer<QSettings> QgsCollapsibleGroupBox::mSettings
protected

Definition at line 246 of file qgscollapsiblegroupbox.h.

Property Documentation

§ saveCheckedState

bool QgsCollapsibleGroupBox::saveCheckedState
readwrite

Shall the checked state of this group box be saved and loaded persistently in QSettings.

Definition at line 194 of file qgscollapsiblegroupbox.h.

§ saveCollapsedState

bool QgsCollapsibleGroupBox::saveCollapsedState
readwrite

Shall the collapsed state of this group box be saved and loaded persistently in QSettings.

Definition at line 189 of file qgscollapsiblegroupbox.h.


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