QGIS API Documentation  2.9.0-Master
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

Public Member Functions

 QgsCollapsibleGroupBox (QWidget *parent=0, QSettings *settings=0)
 QgsCollapsibleGroupBox (const QString &title, QWidget *parent=0, QSettings *settings=0)
 ~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
- Public Member Functions inherited from QgsCollapsibleGroupBoxBasic
 QgsCollapsibleGroupBoxBasic (QWidget *parent=0)
 QgsCollapsibleGroupBoxBasic (const QString &title, QWidget *parent=0)
 ~QgsCollapsibleGroupBoxBasic ()
bool isCollapsed () const
bool scrollOnExpand ()
void setCollapsed (bool collapse)
void setScrollOnExpand (bool scroll)
 set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded More...
void setSyncGroup (QString grp)
QString syncGroup () const
 Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key. More...

Protected Slots

void loadState ()
void saveState ()

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
bool mCollapsed
bool mInitFlat
bool mInitFlatChecked
QScrollArea * mParentScrollArea
bool mScrollOnExpand
bool mShiftDown
bool mShown
QString mSyncGroup
QWidget * mSyncParent
bool mTitleClicked


bool collapsed
bool saveCheckedState
bool saveCollapsedState
bool scrollOnExpand
QString syncGroup
- Properties inherited from QgsCollapsibleGroupBoxBasic
bool collapsed
bool scrollOnExpand
QString syncGroup

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...
- Static Protected Attributes inherited from QgsCollapsibleGroupBoxBasic
static QIcon mCollapseIcon
static QIcon mExpandIcon

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
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 148 of file qgscollapsiblegroupbox.h.

Constructor & Destructor Documentation

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox ( QWidget *  parent = 0,
QSettings *  settings = 0 

Definition at line 484 of file qgscollapsiblegroupbox.cpp.

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

Definition at line 490 of file qgscollapsiblegroupbox.cpp.

QgsCollapsibleGroupBox::~QgsCollapsibleGroupBox ( )

Definition at line 497 of file qgscollapsiblegroupbox.cpp.

Member Function Documentation

void QgsCollapsibleGroupBox::init ( )

Definition at line 515 of file qgscollapsiblegroupbox.cpp.

void QgsCollapsibleGroupBox::loadState ( )

Definition at line 575 of file qgscollapsiblegroupbox.cpp.

bool QgsCollapsibleGroupBox::saveCheckedState ( )

Definition at line 173 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::saveCollapsedState ( )

Definition at line 172 of file qgscollapsiblegroupbox.h.

QString QgsCollapsibleGroupBox::saveKey ( ) const

Definition at line 556 of file qgscollapsiblegroupbox.cpp.

void QgsCollapsibleGroupBox::saveState ( )

Definition at line 604 of file qgscollapsiblegroupbox.cpp.

void QgsCollapsibleGroupBox::setSaveCheckedState ( bool  save)

set this to true to save/restore checked state

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

Definition at line 171 of file qgscollapsiblegroupbox.h.

void QgsCollapsibleGroupBox::setSaveCollapsedState ( bool  save)

set this to false to not save/restore collapsed state

Definition at line 167 of file qgscollapsiblegroupbox.h.

void QgsCollapsibleGroupBox::setSettingGroup ( const QString &  group)

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

Definition at line 176 of file qgscollapsiblegroupbox.h.

void QgsCollapsibleGroupBox::setSettings ( QSettings *  settings)

Definition at line 506 of file qgscollapsiblegroupbox.cpp.

QString QgsCollapsibleGroupBox::settingGroup ( ) const

Definition at line 177 of file qgscollapsiblegroupbox.h.

void QgsCollapsibleGroupBox::showEvent ( QShowEvent *  event)

Definition at line 534 of file qgscollapsiblegroupbox.cpp.

Member Data Documentation

bool QgsCollapsibleGroupBox::mDelSettings

Definition at line 191 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::mSaveCheckedState

Definition at line 194 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::mSaveCollapsedState

Definition at line 193 of file qgscollapsiblegroupbox.h.

QString QgsCollapsibleGroupBox::mSettingGroup

Definition at line 195 of file qgscollapsiblegroupbox.h.

QPointer<QSettings> QgsCollapsibleGroupBox::mSettings

Definition at line 190 of file qgscollapsiblegroupbox.h.

Property Documentation

bool QgsCollapsibleGroupBox::collapsed

Definition at line 152 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::saveCheckedState

Definition at line 154 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::saveCollapsedState

Definition at line 153 of file qgscollapsiblegroupbox.h.

bool QgsCollapsibleGroupBox::scrollOnExpand

Definition at line 156 of file qgscollapsiblegroupbox.h.

QString QgsCollapsibleGroupBox::syncGroup

Definition at line 155 of file qgscollapsiblegroupbox.h.

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