18#ifndef QGSCOLLAPSIBLEGROUPBOX_H
19#define QGSCOLLAPSIBLEGROUPBOX_H
43 : QToolButton( parent )
53 void mouseReleaseEvent( QMouseEvent *event )
override;
56 bool mAltDown =
false;
57 bool mShiftDown =
false;
79 Q_PROPERTY(
bool collapsed READ isCollapsed WRITE setCollapsed USER
true )
85 Q_PROPERTY( QString syncGroup READ syncGroup WRITE setSyncGroup )
91 Q_PROPERTY(
bool scrollOnExpand READ scrollOnExpand WRITE setScrollOnExpand )
100 bool isCollapsed()
const {
return mCollapsed; }
107 void setCollapsed(
bool collapse );
117 void setSyncGroup(
const QString &grp );
130 void checkToggled(
bool ckd );
131 void checkClicked(
bool ckd );
132 void toggleCollapsed();
139 void setStyleSheet(
const QString &style );
144 void collapseExpandFixes();
146 void showEvent( QShowEvent *event )
override;
147 void mousePressEvent( QMouseEvent *event )
override;
148 void mouseReleaseEvent( QMouseEvent *event )
override;
149 void changeEvent( QEvent *event )
override;
152 QRect titleRect()
const;
153 void clearModifiers();
160 QScrollArea *mParentScrollArea =
nullptr;
162 QWidget *mSyncParent =
nullptr;
196 Q_PROPERTY(
bool saveCollapsedState READ saveCollapsedState WRITE setSaveCollapsedState )
201 Q_PROPERTY(
bool saveCheckedState READ saveCheckedState WRITE setSaveCheckedState )
212 void setSaveCollapsedState(
bool save ) { mSaveCollapsedState = save; }
248 void saveState()
const;
251 void showEvent( QShowEvent *event )
override;
252 QString saveKey()
const;
259 QPointer<QgsSettings> mSettings;
262 bool mSaveCollapsedState;
263 bool mSaveCheckedState;
264 QString mSettingGroup;
A groupbox that collapses/expands when toggled.
bool scrollOnExpand()
If this is set to false the parent QScrollArea will not be automatically scrolled to this widget's co...
void setScrollOnExpand(bool scroll)
Sets this to false to not automatically scroll parent QScrollArea to this widget's contents when expa...
QString syncGroup() const
Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier ...
void collapsedStateChanged(bool collapsed)
Signal emitted when groupbox collapsed/expanded state is changed, and when first shown.
A groupbox that collapses/expands when toggled and can save its collapsed and checked states.
void setSaveCheckedState(bool save)
Set this to true to save/restore checked state.
bool saveCollapsedState()
void setSettingGroup(const QString &group)
Sets this to a defined string to share save/restore states across different parent dialogs.
QString settingGroup() const
Returns the name of the setting group in which the collapsed state will be saved.
This class is a composition of two QSettings instances: