Skip to content

Commit c6bb6b7

Browse files
author
jef
committedJul 13, 2009

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed
 

‎src/app/qgslabeldialog.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void QgsLabelDialog::init( )
152152
mFont.setFamily( myLabelAttributes->family() );
153153
if ( myLabelAttributes->sizeIsSet() )
154154
{
155-
mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
155+
mFont.setPointSizeF( myLabelAttributes->size() );
156156

157157
int myTypeInt = myLabelAttributes->sizeType();
158158
if ( myTypeInt == QgsLabelAttributes::PointUnits )
@@ -166,10 +166,12 @@ void QgsLabelDialog::init( )
166166
}
167167
else //defaults for when no size has been set
168168
{
169-
mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
169+
mFont.setPointSizeF( myLabelAttributes->size() );
170170
radioFontSizeUnitsPoints->setChecked( true );
171171
}
172172

173+
spinFontSize->setValue( myLabelAttributes->size() );
174+
173175
if ( myLabelAttributes->boldIsSet() )
174176
{
175177
mFont.setBold( myLabelAttributes->bold() );
@@ -200,8 +202,8 @@ void QgsLabelDialog::init( )
200202
{
201203
radioOffsetUnitsMap->setChecked( true );
202204
}
203-
spinXOffset->setValue( static_cast<int>( myLabelAttributes->xOffset() ) );
204-
spinYOffset->setValue( static_cast<int>( myLabelAttributes->yOffset() ) );
205+
spinXOffset->setValue( myLabelAttributes->xOffset() );
206+
spinYOffset->setValue( myLabelAttributes->yOffset() );
205207
}
206208
else //defaults for when no offset is defined
207209
{
@@ -247,7 +249,7 @@ void QgsLabelDialog::init( )
247249
{
248250
radioBufferUnitsMap->setChecked( true );
249251
}
250-
spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
252+
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
251253
}
252254
else //defaults for when no offset is defined
253255
{
@@ -259,7 +261,7 @@ void QgsLabelDialog::init( )
259261
chkUseBuffer->setChecked( myLabelAttributes->bufferEnabled() );
260262

261263
//NOTE: do we need this line too? TS
262-
spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
264+
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
263265
//TODO - transparency attributes for buffers
264266

265267
listWidget->setItemSelected( listWidget->item( 0 ), true );
@@ -271,11 +273,16 @@ void QgsLabelDialog::changeFont( void )
271273
{
272274
QgsDebugMsg( "entering." );
273275

276+
qreal fontSize = mFont.pointSizeF();
274277
bool resultFlag;
275278
mFont = QFontDialog::getFont( &resultFlag, mFont, this );
276279
if ( resultFlag )
277280
{
278-
// font is set to the font the user selected
281+
if ( mFont.pointSizeF() != fontSize )
282+
{
283+
// font is set to the font the user selected
284+
spinFontSize->setValue( mFont.pointSizeF() );
285+
}
279286
}
280287
else
281288
{
@@ -341,7 +348,7 @@ void QgsLabelDialog::apply()
341348
{
342349
myTypeInt = QgsLabelAttributes::MapUnits;
343350
}
344-
myLabelAttributes->setSize( mFont.pointSize(), myTypeInt );
351+
myLabelAttributes->setSize( mFont.pointSizeF(), myTypeInt );
345352
myLabelAttributes->setBold( mFont.bold() );
346353
myLabelAttributes->setItalic( mFont.italic() );
347354
myLabelAttributes->setUnderline( mFont.underline() );

‎src/app/qgslabeldialog.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ class QgsLabelDialog: public QWidget, private Ui::QgsLabelDialogBase
7474

7575
void on_cboLabelField_activated( int ) {emit labelSourceSet(); }
7676

77+
void on_spinFontSize_valueChanged( double d ) { mFont.setPointSizeF( d ); lblSample->setFont( mFont ); }
78+
7779
signals:
78-
/* emitted when anitem in label source list is chosen */
80+
/* emitted when an item in label source list is chosen */
7981
void labelSourceSet();
8082

8183
protected:

‎src/ui/qgslabeldialogbase.ui

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,16 @@
180180
</item>
181181
<item row="0" column="1" >
182182
<widget class="QLabel" name="textLabel5_2_2_3_2" >
183-
<property name="enabled" >
184-
<bool>false</bool>
185-
</property>
186183
<property name="text" >
187-
<string>Font transparency</string>
184+
<string>Font size</string>
188185
</property>
189186
<property name="alignment" >
190187
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
191188
</property>
192189
</widget>
193190
</item>
194191
<item row="0" column="2" >
195-
<widget class="QSpinBox" name="spinFontTransparency" >
196-
<property name="enabled" >
197-
<bool>false</bool>
198-
</property>
192+
<widget class="QDoubleSpinBox" name="spinFontSize" >
199193
<property name="sizePolicy" >
200194
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
201195
<horstretch>0</horstretch>
@@ -208,12 +202,6 @@
208202
<height>0</height>
209203
</size>
210204
</property>
211-
<property name="suffix" >
212-
<string>%</string>
213-
</property>
214-
<property name="maximum" >
215-
<number>100</number>
216-
</property>
217205
<property name="value" >
218206
<number>0</number>
219207
</property>
@@ -469,7 +457,7 @@
469457
</widget>
470458
</item>
471459
<item row="1" column="1" >
472-
<widget class="QSpinBox" name="spinBufferSize" />
460+
<widget class="QDoubleSpinBox" name="spinBufferSize" />
473461
</item>
474462
<item row="2" column="0" >
475463
<widget class="QLabel" name="textLabel5_2_2_3" >
@@ -575,7 +563,7 @@
575563
</widget>
576564
</item>
577565
<item row="0" column="1" >
578-
<widget class="QSpinBox" name="spinXOffset" >
566+
<widget class="QDoubleSpinBox" name="spinXOffset" >
579567
<property name="minimum" >
580568
<number>-99</number>
581569
</property>
@@ -589,7 +577,7 @@
589577
</widget>
590578
</item>
591579
<item row="1" column="1" >
592-
<widget class="QSpinBox" name="spinYOffset" >
580+
<widget class="QDoubleSpinBox" name="spinYOffset" >
593581
<property name="minimum" >
594582
<number>-99</number>
595583
</property>
@@ -1055,7 +1043,7 @@
10551043
<tabstop>leDefaultLabel</tabstop>
10561044
<tabstop>btnDefaultFont</tabstop>
10571045
<tabstop>pbnDefaultFontColor</tabstop>
1058-
<tabstop>spinFontTransparency</tabstop>
1046+
<tabstop>spinFontSize</tabstop>
10591047
<tabstop>radioFontSizeUnitsPoints</tabstop>
10601048
<tabstop>radioFontSizeUnitsMap</tabstop>
10611049
<tabstop>spinAngle</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.