diff --git a/src/app/main.cpp b/src/app/main.cpp index f4efef2614d6..65c06e5e2169 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -474,13 +474,17 @@ int main( int argc, char *argv[] ) } #endif -#ifdef Q_WS_WIN - //for windows lets use plastique style! - QApplication::setStyle( new QPlastiqueStyle ); -#endif - QSettings mySettings; + // Set the application style. If it's not set QT will use the platform style except on Windows + // as it looks really ugly so we use QPlastiqueStyle. + QString style = mySettings.value("/qgis/style").toString(); + if ( !style.isNull() ) + QApplication::setStyle( style ); +#ifdef Q_WS_WIN + else + QApplication::setStyle( new QPlastiqueStyle ); +#endif /* Translation file for QGIS. */ diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index a7ace0a77a02..02f00ca4cfb7 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #if QT_VERSION >= 0x40500 #include @@ -58,12 +59,19 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) : connect( cmbSize, SIGNAL( activated( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) ); connect( cmbSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) ); connect( cmbSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) ); + connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) ); cmbSize->addItem( "16" ); cmbSize->addItem( "24" ); cmbSize->addItem( "32" ); + QStringList styles = QStyleFactory::keys(); + foreach(QString style, styles ) + { + cmbStyle->addItem( style ); + } + cmbIdentifyMode->addItem( tr( "Current layer" ), 0 ); cmbIdentifyMode->addItem( tr( "Top down, stop at first" ), 1 ); cmbIdentifyMode->addItem( tr( "Top down" ), 2 ); @@ -270,6 +278,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) : // set the theme combo cmbTheme->setCurrentIndex( cmbTheme->findText( settings.value( "/Themes", "default" ).toString() ) ); cmbSize->setCurrentIndex( cmbSize->findText( settings.value( "/IconSize", 24 ).toString() ) ); + QString name = QApplication::style()->objectName(); + cmbStyle->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) ); //set the state of the checkboxes //Changed to default to true as of QGIS 1.7 chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() ); @@ -589,6 +599,7 @@ void QgsOptions::saveOptions() settings.setValue( "/qgis/askToSaveProjectChanges", chbAskToSaveProjectChanges->isChecked() ); settings.setValue( "/qgis/warnOldProjectVersion", chbWarnOldProjectVersion->isChecked() ); settings.setValue( "/qgis/nullValue", leNullValue->text() ); + settings.setValue( "/qgis/style", cmbStyle->currentText() ); //overlay placement method int overlayIndex = mOverlayAlgorithmComboBox->currentIndex(); diff --git a/src/ui/qgsoptionsbase.ui b/src/ui/qgsoptionsbase.ui index fde1c23b4169..61d7c40f1db6 100644 --- a/src/ui/qgsoptionsbase.ui +++ b/src/ui/qgsoptionsbase.ui @@ -127,19 +127,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -153,7 +140,20 @@ - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + Qt::Horizontal @@ -176,22 +176,22 @@ - + + + 0 + - - - - 0 - 0 - - + - Icon theme + Style <i>(QGIS restart required)</i> - + + + + Qt::Horizontal @@ -203,6 +203,23 @@ + + + + + + + + + 0 + 0 + + + + Icon theme + + + @@ -215,6 +232,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -232,6 +262,13 @@ + + + + false + + + @@ -245,13 +282,6 @@ - - - - false - - - @@ -263,19 +293,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -290,6 +307,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + +