@@ -703,23 +703,45 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
703703 mOverlayAlgorithmComboBox ->setCurrentIndex ( 0 );
704704 } // default is central point
705705
706+ // restore window and widget geometry/state
706707 restoreGeometry ( settings.value ( " /Windows/Options/geometry" ).toByteArray () );
708+ mOptionsSplitter ->restoreState ( settings.value ( " /Windows/Options/splitState" ).toByteArray () );
709+
710+ int currentIndx = settings.value ( " /Windows/Options/row" ).toInt ();
711+ mOptionsListWidget ->setCurrentRow ( currentIndx );
712+ mOptionsStackedWidget ->setCurrentIndex ( currentIndx );
707713
708714 // load gdal driver list only when gdal tab is first opened
709715 mLoadedGdalDriverList = false ;
710716
711- // tabWidget->setCurrentIndex( settings.value( "/Windows/Options/row" ).toInt() );
712- int currentTab = settings.value ( " /Windows/Options/row" ).toInt ();
713- tabWidget->setCurrentIndex ( currentTab );
714- on_tabWidget_currentChanged ( currentTab );
717+ // update option section frame state
718+ on_mOptionsListWidget_currentRowChanged ( currentIndx );
715719}
716720
717721// ! Destructor
718722QgsOptions::~QgsOptions ()
719723{
720724 QSettings settings;
721725 settings.setValue ( " /Windows/Options/geometry" , saveGeometry () );
722- settings.setValue ( " /Windows/Options/row" , tabWidget->currentIndex () );
726+ settings.setValue ( " /Windows/Options/splitState" , mOptionsSplitter ->saveState () );
727+ settings.setValue ( " /Windows/Options/row" , mOptionsListWidget ->currentRow () );
728+ }
729+
730+ void QgsOptions::showEvent ( QShowEvent * e )
731+ {
732+ Q_UNUSED ( e );
733+ on_mOptionsSplitter_splitterMoved ( 0 , 0 );
734+ }
735+
736+ void QgsOptions::on_mOptionsSplitter_splitterMoved ( int pos, int index )
737+ {
738+ Q_UNUSED ( pos );
739+ Q_UNUSED ( index );
740+ // when list widget is collapsed, show vert scrollbar to hide text, making view icon-only, like a toolbar
741+ // mOptionsListWidget has 32px wide icons with minimum width for widget at 58
742+ bool iconOnly = mOptionsListWidget ->width () <= 60 ;
743+ mOptionsListWidget ->setVerticalScrollBarPolicy ( iconOnly ? Qt::ScrollBarAlwaysOn : Qt::ScrollBarAsNeeded );
744+ mOptionsListWidget ->setWordWrap ( !iconOnly );
723745}
724746
725747void QgsOptions::on_cbxProjectDefaultNew_toggled ( bool checked )
@@ -1479,10 +1501,10 @@ void QgsOptions::on_mClearCache_clicked()
14791501#endif
14801502}
14811503
1482- void QgsOptions::on_tabWidget_currentChanged ( int theTab )
1504+ void QgsOptions::on_mOptionsListWidget_currentRowChanged ( int theIndx )
14831505{
14841506 // load gdal driver list when gdal tab is first opened
1485- if ( theTab == 1 && ! mLoadedGdalDriverList )
1507+ if ( theIndx == 2 && ! mLoadedGdalDriverList )
14861508 {
14871509 loadGdalDriverList ();
14881510 }
0 commit comments