Skip to content
Permalink
Browse files

use applications default font instead of style sheet to set options a…

…nd determine default size (fixes 5155176)
  • Loading branch information
jef-n committed Jan 18, 2012
1 parent b94b4b4 commit 2664dbfed3c1e2a3263d9e24bafdb09df4ca0bfc
Showing with 29 additions and 44 deletions.
  1. +4 −2 src/app/qgisapp.cpp
  2. +0 −2 src/app/qgisapp.h
  3. +5 −7 src/app/qgsoptions.cpp
  4. +20 −33 src/ui/qgsoptionsbase.ui
6 src/app/qgisapp.cpp 100644 → 100755
@@ -425,7 +425,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
qApp->processEvents();

QSettings settings;
setFontSize( settings.value( "/fontSize", QGIS_FONT_SIZE ).toInt() );
setFontSize( settings.value( "/fontPointSize", font().pointSize() ).toInt() );

// "theMapCanvas" used to find this canonical instance later
mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" );
@@ -1024,7 +1024,9 @@ void QgisApp::createActionGroups()

void QgisApp::setFontSize( int fontSize )
{
setStyleSheet( QString( "font-size: %1pt;" ).arg( fontSize ) );
QFont theFont = font();
theFont.setPointSize( fontSize );
setFont( theFont );
}

void QgisApp::createMenus()
@@ -1154,10 +1154,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

#ifdef ANDROID
#define QGIS_ICON_SIZE 32
#define QGIS_FONT_SIZE 8
#else
#define QGIS_ICON_SIZE 24
#define QGIS_FONT_SIZE 12
#endif

#endif
12 src/app/qgsoptions.cpp 100644 → 100755
@@ -62,9 +62,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
connect( cmbIconSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
connect( cmbIconSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );

connect( cmbFontSize, SIGNAL( activated( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
connect( cmbFontSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
connect( cmbFontSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
connect( spinFontSize, SIGNAL( valueChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );

connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );

@@ -282,7 +280,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
// set the theme combo
cmbTheme->setCurrentIndex( cmbTheme->findText( settings.value( "/Themes", "default" ).toString() ) );
cmbIconSize->setCurrentIndex( cmbIconSize->findText( settings.value( "/IconSize", QGIS_ICON_SIZE ).toString() ) );
cmbFontSize->setCurrentIndex( cmbFontSize->findText( settings.value( "/menuSize", QGIS_FONT_SIZE ).toString() ) );
spinFontSize->setValue( settings.value( "/fontPointSize", QgisApp::instance()->font().pointSize() ).toInt() );
QString name = QApplication::style()->objectName();
cmbStyle->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );
//set the state of the checkboxes
@@ -522,9 +520,9 @@ void QgsOptions::iconSizeChanged( const QString &iconSize )
QgisApp::instance()->setIconSizes( iconSize.toInt() );
}

void QgsOptions::fontSizeChanged( const QString &menuSize )
void QgsOptions::fontSizeChanged( const QString &fontSize )
{
QgisApp::instance()->setFontSize( menuSize.toInt() );
QgisApp::instance()->setFontSize( fontSize.toInt() );
}

QString QgsOptions::theme()
@@ -651,7 +649,7 @@ void QgsOptions::saveOptions()
}

settings.setValue( "/IconSize", cmbIconSize->currentText() );
settings.setValue( "/fontSize", cmbFontSize->currentText() );
settings.setValue( "/fontPointSize", spinFontSize->value() );

settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() );
//check behaviour so default projection when new layer is added with no
@@ -66,8 +66,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>779</width>
<height>791</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -322,22 +322,10 @@
</spacer>
</item>
<item>
<widget class="QComboBox" name="cmbFontSize">
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>12</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<widget class="QSpinBox" name="spinFontSize">
<property name="minimum">
<number>4</number>
</property>
</widget>
</item>
</layout>
@@ -696,8 +684,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>604</width>
<height>494</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@@ -870,8 +858,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>483</width>
<height>478</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
@@ -1156,8 +1144,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>257</width>
<height>93</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_10">
@@ -1231,8 +1219,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>781</width>
<height>741</height>
<width>569</width>
<height>510</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_13">
@@ -1577,8 +1565,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>412</width>
<height>411</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@@ -1751,8 +1739,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>523</width>
<height>560</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_17">
@@ -1848,8 +1836,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>763</height>
<width>321</width>
<height>541</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">
@@ -2086,7 +2074,6 @@
<tabstop>pbnCanvasColor</tabstop>
<tabstop>cmbTheme</tabstop>
<tabstop>cmbIconSize</tabstop>
<tabstop>cmbFontSize</tabstop>
<tabstop>cmbLegendDoubleClickAction</tabstop>
<tabstop>capitaliseCheckBox</tabstop>
<tabstop>cbxLegendClassifiers</tabstop>

0 comments on commit 2664dbf

Please sign in to comment.
You can’t perform that action at this time.