Skip to content

Commit bfb2b7a

Browse files
committed
Reorganize Options dialog
- Add Data Sources, Canvas/Legend sections - Fix excess whitespace issue for list widget pane in QtDesigner and QGIS - Switch GDAL drive table load to on current page name
1 parent a928d51 commit bfb2b7a

File tree

3 files changed

+1581
-1227
lines changed

3 files changed

+1581
-1227
lines changed

src/app/qgsoptions.cpp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
104104

105105
// read the current browser and set it
106106
QSettings settings;
107+
// mOptionsListWidget width is fixed to takes up less space in QtDesigner
108+
// revert it now unless the splitter's state hasn't been saved yet
109+
mOptionsListWidget->setMaximumWidth(
110+
settings.value( "/Windows/Options/splitState" ).isNull() ? 150 : 16777215 );
111+
107112
int identifyMode = settings.value( "/Map/identifyMode", 0 ).toInt();
108113
cmbIdentifyMode->setCurrentIndex( cmbIdentifyMode->findData( identifyMode ) );
109114
cbxAutoFeatureForm->setChecked( settings.value( "/Map/identifyAutoFeatureForm", false ).toBool() );
@@ -444,7 +449,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
444449
cmbIconSize->setCurrentIndex( cmbIconSize->findText( settings.value( "/IconSize", QGIS_ICON_SIZE ).toString() ) );
445450

446451
// set font size and family
447-
blockSignals( true );
452+
// TODO: move all stylesheet options blockSignals to separate method when implementing app stylesheet
453+
spinFontSize->blockSignals( true );
454+
mFontFamilyRadioQt->blockSignals( true );
455+
mFontFamilyRadioCustom->blockSignals( true );
456+
mFontFamilyComboBox->blockSignals( true );
457+
448458
spinFontSize->setValue( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() );
449459
QString fontFamily = settings.value( "/fontFamily", QVariant( "QtDefault" ) ).toString();
450460
bool isQtDefault = ( fontFamily == QString( "QtDefault" ) );
@@ -460,7 +470,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
460470
}
461471
delete tempFont;
462472
}
463-
blockSignals( false );
473+
spinFontSize->blockSignals( false );
474+
mFontFamilyRadioQt->blockSignals( false );
475+
mFontFamilyRadioCustom->blockSignals( false );
476+
mFontFamilyComboBox->blockSignals( false );
464477

465478
mMessageTimeoutSpnBx->setValue( settings.value( "/qgis/messageTimeout", 5 ).toInt() );
466479

@@ -718,9 +731,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
718731

719732
// load gdal driver list only when gdal tab is first opened
720733
mLoadedGdalDriverList = false;
721-
722-
// update option section frame state
723-
on_mOptionsListWidget_currentRowChanged( currentIndx );
724734
}
725735

726736
//! Destructor
@@ -735,6 +745,7 @@ QgsOptions::~QgsOptions()
735745
void QgsOptions::showEvent( QShowEvent * e )
736746
{
737747
Q_UNUSED( e );
748+
on_mOptionsStackedWidget_currentChanged( -1 );
738749
updateVerticalTabs();
739750
}
740751

@@ -746,6 +757,8 @@ void QgsOptions::paintEvent( QPaintEvent * e )
746757

747758
void QgsOptions::updateVerticalTabs()
748759
{
760+
if ( mOptionsListWidget->maximumWidth() != 16777215 )
761+
mOptionsListWidget->setMaximumWidth( 16777215 );
749762
// auto-resize splitter for vert scrollbar without covering icons in icon-only mode
750763
// TODO: mOptionsListWidget has fixed 32px wide icons for now, allow user-defined
751764
// Note: called on splitter resize and dialog paint event, so only update when necessary
@@ -1539,10 +1552,12 @@ void QgsOptions::on_mClearCache_clicked()
15391552
#endif
15401553
}
15411554

1542-
void QgsOptions::on_mOptionsListWidget_currentRowChanged( int theIndx )
1555+
void QgsOptions::on_mOptionsStackedWidget_currentChanged( int theIndx )
15431556
{
1557+
Q_UNUSED( theIndx );
15441558
// load gdal driver list when gdal tab is first opened
1545-
if ( theIndx == 2 && ! mLoadedGdalDriverList )
1559+
if ( mOptionsStackedWidget->currentWidget()->objectName() == QString( "mOptionsPage_02" )
1560+
&& ! mLoadedGdalDriverList )
15461561
{
15471562
loadGdalDriverList();
15481563
}

src/app/qgsoptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
194194
*/
195195
void on_pbnExportScales_clicked();
196196

197-
/** Auto slot executed when the active item in the option section list widget is changed
197+
/** Auto slot executed when the active page in the option section widget is changed
198198
* @note added in 1.9
199199
*/
200-
void on_mOptionsListWidget_currentRowChanged( int theIndx );
200+
void on_mOptionsStackedWidget_currentChanged( int theIndx );
201201

202202
/** Slot to update widget of vertical tabs
203203
* @note added in QGIS 1.9

0 commit comments

Comments
 (0)