Skip to content

Commit 2664dbf

Browse files
committedJan 18, 2012
use applications default font instead of style sheet to set options and determine default size (fixes 5155176)
1 parent b94b4b4 commit 2664dbf

File tree

4 files changed

+29
-44
lines changed

4 files changed

+29
-44
lines changed
 

‎src/app/qgisapp.cpp

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
425425
qApp->processEvents();
426426

427427
QSettings settings;
428-
setFontSize( settings.value( "/fontSize", QGIS_FONT_SIZE ).toInt() );
428+
setFontSize( settings.value( "/fontPointSize", font().pointSize() ).toInt() );
429429

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

10251025
void QgisApp::setFontSize( int fontSize )
10261026
{
1027-
setStyleSheet( QString( "font-size: %1pt;" ).arg( fontSize ) );
1027+
QFont theFont = font();
1028+
theFont.setPointSize( fontSize );
1029+
setFont( theFont );
10281030
}
10291031

10301032
void QgisApp::createMenus()

‎src/app/qgisapp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
11541154

11551155
#ifdef ANDROID
11561156
#define QGIS_ICON_SIZE 32
1157-
#define QGIS_FONT_SIZE 8
11581157
#else
11591158
#define QGIS_ICON_SIZE 24
1160-
#define QGIS_FONT_SIZE 12
11611159
#endif
11621160

11631161
#endif

‎src/app/qgsoptions.cpp

100644100755
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
6262
connect( cmbIconSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
6363
connect( cmbIconSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
6464

65-
connect( cmbFontSize, SIGNAL( activated( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
66-
connect( cmbFontSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
67-
connect( cmbFontSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
65+
connect( spinFontSize, SIGNAL( valueChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
6866

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

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

525-
void QgsOptions::fontSizeChanged( const QString &menuSize )
523+
void QgsOptions::fontSizeChanged( const QString &fontSize )
526524
{
527-
QgisApp::instance()->setFontSize( menuSize.toInt() );
525+
QgisApp::instance()->setFontSize( fontSize.toInt() );
528526
}
529527

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

653651
settings.setValue( "/IconSize", cmbIconSize->currentText() );
654-
settings.setValue( "/fontSize", cmbFontSize->currentText() );
652+
settings.setValue( "/fontPointSize", spinFontSize->value() );
655653

656654
settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() );
657655
//check behaviour so default projection when new layer is added with no

‎src/ui/qgsoptionsbase.ui

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<rect>
6767
<x>0</x>
6868
<y>0</y>
69-
<width>803</width>
70-
<height>763</height>
69+
<width>779</width>
70+
<height>791</height>
7171
</rect>
7272
</property>
7373
<layout class="QGridLayout" name="gridLayout">
@@ -322,22 +322,10 @@
322322
</spacer>
323323
</item>
324324
<item>
325-
<widget class="QComboBox" name="cmbFontSize">
326-
<item>
327-
<property name="text">
328-
<string>8</string>
329-
</property>
330-
</item>
331-
<item>
332-
<property name="text">
333-
<string>12</string>
334-
</property>
335-
</item>
336-
<item>
337-
<property name="text">
338-
<string>16</string>
339-
</property>
340-
</item>
325+
<widget class="QSpinBox" name="spinFontSize">
326+
<property name="minimum">
327+
<number>4</number>
328+
</property>
341329
</widget>
342330
</item>
343331
</layout>
@@ -696,8 +684,8 @@
696684
<rect>
697685
<x>0</x>
698686
<y>0</y>
699-
<width>803</width>
700-
<height>763</height>
687+
<width>604</width>
688+
<height>494</height>
701689
</rect>
702690
</property>
703691
<layout class="QGridLayout" name="gridLayout_8">
@@ -870,8 +858,8 @@
870858
<rect>
871859
<x>0</x>
872860
<y>0</y>
873-
<width>803</width>
874-
<height>763</height>
861+
<width>483</width>
862+
<height>478</height>
875863
</rect>
876864
</property>
877865
<layout class="QGridLayout" name="gridLayout_4">
@@ -1156,8 +1144,8 @@
11561144
<rect>
11571145
<x>0</x>
11581146
<y>0</y>
1159-
<width>803</width>
1160-
<height>763</height>
1147+
<width>257</width>
1148+
<height>93</height>
11611149
</rect>
11621150
</property>
11631151
<layout class="QGridLayout" name="gridLayout_10">
@@ -1231,8 +1219,8 @@
12311219
<rect>
12321220
<x>0</x>
12331221
<y>0</y>
1234-
<width>781</width>
1235-
<height>741</height>
1222+
<width>569</width>
1223+
<height>510</height>
12361224
</rect>
12371225
</property>
12381226
<layout class="QGridLayout" name="gridLayout_13">
@@ -1577,8 +1565,8 @@
15771565
<rect>
15781566
<x>0</x>
15791567
<y>0</y>
1580-
<width>803</width>
1581-
<height>763</height>
1568+
<width>412</width>
1569+
<height>411</height>
15821570
</rect>
15831571
</property>
15841572
<layout class="QGridLayout" name="gridLayout_15">
@@ -1751,8 +1739,8 @@
17511739
<rect>
17521740
<x>0</x>
17531741
<y>0</y>
1754-
<width>803</width>
1755-
<height>763</height>
1742+
<width>523</width>
1743+
<height>560</height>
17561744
</rect>
17571745
</property>
17581746
<layout class="QGridLayout" name="gridLayout_17">
@@ -1848,8 +1836,8 @@
18481836
<rect>
18491837
<x>0</x>
18501838
<y>0</y>
1851-
<width>803</width>
1852-
<height>763</height>
1839+
<width>321</width>
1840+
<height>541</height>
18531841
</rect>
18541842
</property>
18551843
<layout class="QGridLayout" name="gridLayout_20">
@@ -2086,7 +2074,6 @@
20862074
<tabstop>pbnCanvasColor</tabstop>
20872075
<tabstop>cmbTheme</tabstop>
20882076
<tabstop>cmbIconSize</tabstop>
2089-
<tabstop>cmbFontSize</tabstop>
20902077
<tabstop>cmbLegendDoubleClickAction</tabstop>
20912078
<tabstop>capitaliseCheckBox</tabstop>
20922079
<tabstop>cbxLegendClassifiers</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.