mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-07 00:03:52 -05:00
QgsCollapsibleGroupBox: rename mSaveState to mSaveCollapsedState and update saveState/restoreState, update raster save dialog
This commit is contained in:
parent
cf398ca130
commit
fef272e1a1
@ -11,16 +11,19 @@ class QgsCollapsibleGroupBox : QGroupBox
|
|||||||
bool isCollapsed() const;
|
bool isCollapsed() const;
|
||||||
void setCollapsed( bool collapse );
|
void setCollapsed( bool collapse );
|
||||||
|
|
||||||
//! set this to false to not save/restore check and collapse state
|
//! set this to false to not save/restore collapsed state
|
||||||
void setSaveState( bool save );
|
void setSaveCollapsedState( bool save );
|
||||||
//! set this to true to save/restore checked state
|
/** set this to true to save/restore checked state
|
||||||
/** @note only turn on mSaveCheckedState for groupboxes NOT used
|
* @note only turn on mSaveCheckedState for groupboxes NOT used
|
||||||
* in multiple places or used as options for different parent objects */
|
* in multiple places or used as options for different parent objects */
|
||||||
void setSaveCheckedState( bool save );
|
void setSaveCheckedState( bool save );
|
||||||
|
bool saveCollapsedState();
|
||||||
bool saveCheckedState();
|
bool saveCheckedState();
|
||||||
|
|
||||||
//! set this to a defined string to share save/restore collapsed state across dialogs
|
//! set this to a defined string to share save/restore collapsed state across dialogs
|
||||||
void setSettingGroup( const QString &group );
|
void setSettingGroup( const QString &group );
|
||||||
QString settingGroup() const;
|
QString settingGroup() const;
|
||||||
|
|
||||||
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
|
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
|
||||||
void setScrollOnExpand( bool scroll );
|
void setScrollOnExpand( bool scroll );
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void QgsCollapsibleGroupBox::init()
|
|||||||
{
|
{
|
||||||
// variables
|
// variables
|
||||||
mCollapsed = false;
|
mCollapsed = false;
|
||||||
mSaveState = true;
|
mSaveCollapsedState = true;
|
||||||
// NOTE: only turn on mSaveCheckedState for groupboxes NOT used
|
// NOTE: only turn on mSaveCheckedState for groupboxes NOT used
|
||||||
// in multiple places or used as options for different parent objects
|
// in multiple places or used as options for different parent objects
|
||||||
mSaveCheckedState = false;
|
mSaveCheckedState = false;
|
||||||
@ -179,7 +179,7 @@ QString QgsCollapsibleGroupBox::saveKey() const
|
|||||||
|
|
||||||
void QgsCollapsibleGroupBox::loadState()
|
void QgsCollapsibleGroupBox::loadState()
|
||||||
{
|
{
|
||||||
if ( ! mSaveState )
|
if ( !isEnabled() || ( !mSaveCollapsedState && !mSaveCheckedState ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setUpdatesEnabled( false );
|
setUpdatesEnabled( false );
|
||||||
@ -193,21 +193,27 @@ void QgsCollapsibleGroupBox::loadState()
|
|||||||
if ( ! val.isNull() )
|
if ( ! val.isNull() )
|
||||||
setChecked( val.toBool() );
|
setChecked( val.toBool() );
|
||||||
}
|
}
|
||||||
|
if ( mSaveCollapsedState )
|
||||||
|
{
|
||||||
val = settings.value( key + "/collapsed" );
|
val = settings.value( key + "/collapsed" );
|
||||||
if ( ! val.isNull() )
|
if ( ! val.isNull() )
|
||||||
setCollapsed( val.toBool() );
|
setCollapsed( val.toBool() );
|
||||||
|
}
|
||||||
|
|
||||||
setUpdatesEnabled( true );
|
setUpdatesEnabled( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCollapsibleGroupBox::saveState()
|
void QgsCollapsibleGroupBox::saveState()
|
||||||
{
|
{
|
||||||
if ( ! mSaveState )
|
if ( !isEnabled() || ( !mSaveCollapsedState && !mSaveCheckedState ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
QString key = saveKey();
|
QString key = saveKey();
|
||||||
|
|
||||||
if ( mSaveCheckedState )
|
if ( mSaveCheckedState )
|
||||||
settings.setValue( key + "/checked", isChecked() );
|
settings.setValue( key + "/checked", isChecked() );
|
||||||
|
if ( mSaveCollapsedState )
|
||||||
settings.setValue( key + "/collapsed", isCollapsed() );
|
settings.setValue( key + "/collapsed", isCollapsed() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,16 +42,19 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
|
|||||||
bool isCollapsed() const { return mCollapsed; }
|
bool isCollapsed() const { return mCollapsed; }
|
||||||
void setCollapsed( bool collapse );
|
void setCollapsed( bool collapse );
|
||||||
|
|
||||||
//! set this to false to not save/restore check and collapse state
|
//! set this to false to not save/restore collapsed state
|
||||||
void setSaveState( bool save ) { mSaveState = save; }
|
void setSaveCollapsedState( bool save ) { mSaveCollapsedState = save; }
|
||||||
//! set this to true to save/restore checked state
|
/** set this to true to save/restore checked state
|
||||||
/** @note only turn on mSaveCheckedState for groupboxes NOT used
|
* @note only turn on mSaveCheckedState for groupboxes NOT used
|
||||||
* in multiple places or used as options for different parent objects */
|
* in multiple places or used as options for different parent objects */
|
||||||
void setSaveCheckedState( bool save ) { mSaveCheckedState = save; }
|
void setSaveCheckedState( bool save ) { mSaveCheckedState = save; }
|
||||||
|
bool saveCollapsedState() { return mSaveCollapsedState; }
|
||||||
bool saveCheckedState() { return mSaveCheckedState; }
|
bool saveCheckedState() { return mSaveCheckedState; }
|
||||||
|
|
||||||
//! set this to a defined string to share save/restore collapsed state across dialogs
|
//! set this to a defined string to share save/restore collapsed state across dialogs
|
||||||
void setSettingGroup( const QString &group ) { mSettingGroup = group; }
|
void setSettingGroup( const QString &group ) { mSettingGroup = group; }
|
||||||
QString settingGroup() const { return mSettingGroup; }
|
QString settingGroup() const { return mSettingGroup; }
|
||||||
|
|
||||||
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
|
//! set this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded
|
||||||
void setScrollOnExpand( bool scroll ) { mScrollOnExpand = scroll; }
|
void setScrollOnExpand( bool scroll ) { mScrollOnExpand = scroll; }
|
||||||
|
|
||||||
@ -78,7 +81,7 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
|
|||||||
QString saveKey() const;
|
QString saveKey() const;
|
||||||
|
|
||||||
bool mCollapsed;
|
bool mCollapsed;
|
||||||
bool mSaveState;
|
bool mSaveCollapsedState;
|
||||||
bool mSaveCheckedState;
|
bool mSaveCheckedState;
|
||||||
QString mSettingGroup;
|
QString mSettingGroup;
|
||||||
bool mInitFlat;
|
bool mInitFlat;
|
||||||
|
|||||||
@ -100,6 +100,13 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterLayer* rasterLa
|
|||||||
mPyramidsGroupBox->setEnabled( false );
|
mPyramidsGroupBox->setEnabled( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore checked state for most groupboxes (default is to restore collapsed state)
|
||||||
|
// create options and pyramids will be preset, if user has selected defaults in the gdal options dlg
|
||||||
|
mCreateOptionsGroupBox->setSaveCheckedState( true );
|
||||||
|
mTilesGroupBox->setSaveCheckedState( true );
|
||||||
|
// don't restore nodata, it needs user input
|
||||||
|
// pyramids are not necessarily built every time
|
||||||
|
|
||||||
updateCrsGroup();
|
updateCrsGroup();
|
||||||
|
|
||||||
QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
|
QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user