18 #ifndef QGSCOLLAPSIBLEGROUPBOX_H 19 #define QGSCOLLAPSIBLEGROUPBOX_H 23 #include <QToolButton> 24 #include <QMouseEvent> 43 : QToolButton( parent )
55 mAltDown = (
event->modifiers() & ( Qt::AltModifier | Qt::ControlModifier ) );
56 mShiftDown = (
event->modifiers() & Qt::ShiftModifier );
57 QToolButton::mouseReleaseEvent( event );
61 bool mAltDown =
false;
62 bool mShiftDown =
false;
84 Q_PROPERTY(
bool collapsed READ isCollapsed WRITE setCollapsed USER
true )
90 Q_PROPERTY( QString syncGroup READ syncGroup WRITE setSyncGroup )
96 Q_PROPERTY(
bool scrollOnExpand READ scrollOnExpand WRITE setScrollOnExpand )
105 bool isCollapsed()
const {
return mCollapsed; }
112 void setCollapsed(
bool collapse );
122 void setSyncGroup(
const QString &grp );
132 void collapsedStateChanged(
bool collapsed );
135 void checkToggled(
bool ckd );
136 void checkClicked(
bool ckd );
137 void toggleCollapsed();
143 void collapseExpandFixes();
145 void showEvent( QShowEvent *event )
override;
146 void mousePressEvent( QMouseEvent *event )
override;
147 void mouseReleaseEvent( QMouseEvent *event )
override;
148 void changeEvent( QEvent *event )
override;
151 QRect titleRect()
const;
152 void clearModifiers();
159 QScrollArea *mParentScrollArea =
nullptr;
161 QWidget *mSyncParent =
nullptr;
190 Q_PROPERTY(
bool saveCollapsedState READ saveCollapsedState WRITE setSaveCollapsedState )
195 Q_PROPERTY(
bool saveCheckedState READ saveCheckedState WRITE setSaveCheckedState )
206 void setSaveCollapsedState(
bool save ) { mSaveCollapsedState = save; }
239 void saveState()
const;
243 void showEvent( QShowEvent *event )
override;
244 QString saveKey()
const;
This class is a composition of two QSettings instances:
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.
void setScrollOnExpand(bool scroll)
Set this to false to not automatically scroll parent QScrollArea to this widget's contents when expan...
void showEvent(QShowEvent *event) override
QString syncGroup() const
Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier ...
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 setSettingGroup(const QString &group)
Set this to a defined string to share save/restore states across different parent dialogs...
bool saveCollapsedState()
QPointer< QgsSettings > mSettings
QString settingGroup() const
Returns the name of the setting group in which the collapsed state will be saved. ...