2013-02-11 13:36:20 -07:00
/** \ingroup gui
* \class QgsCollapsibleGroupBoxBasic
* A groupbox that collapses/expands when toggled.
* Basic class QgsCollapsibleGroupBoxBasic does not auto-save collapsed or checked state
2013-02-12 14:43:05 -07:00
* Holding Alt modifier key when toggling collapsed state will synchronize the toggling across other collapsible group boxes with the same syncGroup QString value
2013-02-26 14:10:09 -07:00
* 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
2013-02-11 13:36:20 -07:00
* @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:
2013-02-12 14:43:05 -07:00
* bool collapsed, QString syncGroup
2013-02-11 13:36:20 -07:00
*/
class QgsCollapsibleGroupBoxBasic : QGroupBox
{
%TypeHeaderCode
#include <qgscollapsiblegroupbox.h>
%End
public:
QgsCollapsibleGroupBoxBasic( QWidget *parent = 0 );
QgsCollapsibleGroupBoxBasic( const QString &title, QWidget *parent = 0 );
~QgsCollapsibleGroupBoxBasic();
bool isCollapsed() const;
void setCollapsed( bool collapse );
2013-02-12 14:43:05 -07:00
/** Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key */
QString syncGroup() const;
void setSyncGroup( QString grp );
2013-02-11 13:36:20 -07:00
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
void setScrollOnExpand( bool scroll );
signals:
/** Signal emitted when groupbox collapsed/expanded state is changed, and when first shown */
void collapsedStateChanged( bool collapsed );
public slots:
void checkToggled( bool ckd );
2013-04-13 19:12:18 -06:00
void checkClicked( bool ckd );
2013-02-11 13:36:20 -07:00
void toggleCollapsed();
protected:
void init();
void showEvent( QShowEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void changeEvent( QEvent *event );
void updateStyle();
QRect titleRect() const;
};
/** \ingroup gui
* \class QgsCollapsibleGroupBox
* 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.
2013-02-12 14:43:05 -07:00
* Holding Alt modifier key when toggling collapsed state will synchronize the toggling across other collapsible group boxes with the same syncGroup QString value
2013-02-26 14:10:09 -07:00
* 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
2013-02-11 13:36:20 -07:00
* @see 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:
2013-02-12 14:43:05 -07:00
* bool collapsed, bool saveCollapsedState, bool saveCheckedState, QString syncGroup
2013-02-11 13:36:20 -07:00
*/
class QgsCollapsibleGroupBox : QgsCollapsibleGroupBoxBasic
2012-09-24 02:28:15 +02:00
{
%TypeHeaderCode
#include <qgscollapsiblegroupbox.h>
%End
public:
2013-01-24 11:47:26 -07:00
QgsCollapsibleGroupBox( QWidget *parent = 0, QSettings* settings = 0 );
QgsCollapsibleGroupBox( const QString &title, QWidget *parent = 0, QSettings* settings = 0 );
2012-09-24 02:28:15 +02:00
~QgsCollapsibleGroupBox();
2013-01-24 11:47:26 -07:00
// set custom QSettings pointer if group box was already created from QtDesigner promotion
void setSettings( QSettings* settings );
2012-09-25 18:18:11 -03:00
//! set this to false to not save/restore collapsed state
void setSaveCollapsedState( bool save );
/** set this to true to save/restore checked state
* @note only turn on mSaveCheckedState for groupboxes NOT used
2012-09-24 02:28:15 +02:00
* in multiple places or used as options for different parent objects */
void setSaveCheckedState( bool save );
2012-09-25 18:18:11 -03:00
bool saveCollapsedState();
2012-09-24 02:28:15 +02:00
bool saveCheckedState();
2012-09-25 18:18:11 -03:00
2013-02-11 13:36:20 -07:00
//! set this to a defined string to share save/restore states across different parent dialogs
2012-09-24 02:28:15 +02:00
void setSettingGroup( const QString &group );
QString settingGroup() const;
2012-09-25 18:18:11 -03:00
2012-09-24 02:28:15 +02:00
protected slots:
void loadState();
void saveState();
protected:
void init();
void showEvent( QShowEvent *event );
QString saveKey() const;
};