Skip to content
Permalink
Browse files
Allow user to select Qt app style
  • Loading branch information
NathanW2 committed Nov 13, 2011
1 parent 8e2e654 commit a02c8ee13598f143d717bdea500ff5dc10bdb555
Showing with 110 additions and 65 deletions.
  1. +9 −5 src/app/main.cpp
  2. +11 −0 src/app/qgsoptions.cpp
  3. +90 −60 src/ui/qgsoptionsbase.ui
@@ -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.
*/
@@ -30,6 +30,7 @@
#include <QLocale>
#include <QToolBar>
#include <QSize>
#include <QStyleFactory>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
@@ -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();
@@ -66,8 +66,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>979</width>
<height>1135</height>
<width>851</width>
<height>1068</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_12">
@@ -127,19 +127,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QgsColorButton" name="pbnCanvasColor">
<property name="minimumSize">
@@ -153,7 +140,20 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="4">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -176,22 +176,22 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="textLabel1_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Icon theme</string>
<string>Style</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<widget class="QComboBox" name="cmbStyle"/>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -203,6 +203,23 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="textLabel1_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Icon theme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbTheme">
<property name="duplicatesEnabled">
@@ -215,6 +232,19 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@@ -232,6 +262,13 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbSize">
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
@@ -245,13 +282,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="cmbSize">
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -263,19 +293,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="cmbLegendDoubleClickAction">
<item>
@@ -290,6 +307,19 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@@ -537,8 +567,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>641</width>
<height>512</height>
<width>786</width>
<height>473</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@@ -711,8 +741,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>567</width>
<height>532</height>
<width>786</width>
<height>473</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
@@ -997,8 +1027,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>289</width>
<height>94</height>
<width>803</width>
<height>414</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_10">
@@ -1072,8 +1102,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>797</width>
<height>490</height>
<width>766</width>
<height>432</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_13">
@@ -1408,8 +1438,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>420</height>
<width>803</width>
<height>414</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@@ -1582,8 +1612,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>583</height>
<width>786</width>
<height>542</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_17">
@@ -1679,8 +1709,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>384</width>
<height>573</height>
<width>786</width>
<height>533</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">

0 comments on commit a02c8ee

Please sign in to comment.