@@ -48,7 +48,7 @@ QgsLabelDialog::QgsLabelDialog( QgsLabel *label, QWidget *parent )
48
48
49
49
connect ( btnDefaultFont, SIGNAL ( clicked () ),
50
50
this , SLOT ( changeFont () ) );
51
- connect ( pbnDefaultBufferColor_2 , SIGNAL ( clicked () ),
51
+ connect ( pbnDefaultBufferColor , SIGNAL ( clicked () ),
52
52
this , SLOT ( changeBufferColor () ) );
53
53
connect ( pbnDefaultFontColor, SIGNAL ( clicked () ),
54
54
this , SLOT ( changeFontColor () ) );
@@ -165,19 +165,12 @@ void QgsLabelDialog::init( )
165
165
mFont .setPointSizeF ( myLabelAttributes->size () );
166
166
167
167
int myTypeInt = myLabelAttributes->sizeType ();
168
- if ( myTypeInt == QgsLabelAttributes::PointUnits )
169
- {
170
- radioFontSizeUnitsPoints->setChecked ( true );
171
- }
172
- else // assume map units is checked
173
- {
174
- radioFontSizeUnitsMap->setChecked ( true );
175
- }
168
+ cboFontSizeUnits->setCurrentIndex ( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
176
169
}
177
170
else // defaults for when no size has been set
178
171
{
179
172
mFont .setPointSizeF ( myLabelAttributes->size () );
180
- radioFontSizeUnitsPoints-> setChecked ( true );
173
+ cboFontSizeUnits-> setCurrentIndex ( 0 );
181
174
}
182
175
183
176
spinFontSize->setValue ( myLabelAttributes->size () );
@@ -220,19 +213,13 @@ void QgsLabelDialog::init( )
220
213
if ( myLabelAttributes->offsetIsSet () )
221
214
{
222
215
int myTypeInt = myLabelAttributes->offsetType ();
223
- if ( myTypeInt == QgsLabelAttributes::PointUnits )
224
- {
225
- radioOffsetUnitsPoints->setChecked ( true );
226
- }
227
- else
228
- {
229
- radioOffsetUnitsMap->setChecked ( true );
230
- }
216
+ cboOffsetUnits->setCurrentIndex ( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
231
217
spinXOffset->setValue ( myLabelAttributes->xOffset () );
232
218
spinYOffset->setValue ( myLabelAttributes->yOffset () );
233
219
}
234
220
else // defaults for when no offset is defined
235
221
{
222
+ cboOffsetUnits->setCurrentIndex ( 0 );
236
223
spinXOffset->setValue ( 0 );
237
224
spinYOffset->setValue ( 0 );
238
225
}
@@ -267,18 +254,12 @@ void QgsLabelDialog::init( )
267
254
if ( myLabelAttributes->bufferSizeIsSet () )
268
255
{
269
256
int myTypeInt = myLabelAttributes->bufferSizeType ();
270
- if ( myTypeInt == QgsLabelAttributes::PointUnits )
271
- {
272
- radioBufferUnitsPoints->setChecked ( true );
273
- }
274
- else
275
- {
276
- radioBufferUnitsMap->setChecked ( true );
277
- }
257
+ cboBufferSizeUnits->setCurrentIndex ( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
278
258
spinBufferSize->setValue ( myLabelAttributes->bufferSize () );
279
259
}
280
260
else // defaults for when no offset is defined
281
261
{
262
+ cboBufferSizeUnits->setCurrentIndex ( 0 );
282
263
spinBufferSize->setValue ( 1 );
283
264
}
284
265
// set the state of the multiline enabled checkbox
@@ -343,8 +324,7 @@ void QgsLabelDialog::changeBufferColor( void )
343
324
344
325
int QgsLabelDialog::itemNoForField ( QString theFieldName, QStringList theFieldList )
345
326
{
346
- int myItemInt = 0 ;
347
- for ( QStringList::Iterator it = theFieldList.begin (); it != theFieldList.end (); ++it )
327
+ int myItemInt = 0 ; for ( QStringList::Iterator it = theFieldList.begin (); it != theFieldList.end (); ++it )
348
328
{
349
329
if ( theFieldName == *it ) return myItemInt;
350
330
++myItemInt;
@@ -367,30 +347,14 @@ void QgsLabelDialog::apply()
367
347
QgsLabelAttributes * myLabelAttributes = mLabel ->labelAttributes ();
368
348
myLabelAttributes->setText ( leDefaultLabel->text () );
369
349
myLabelAttributes->setFamily ( mFont .family () );
370
- int myTypeInt = 0 ;
371
- if ( radioFontSizeUnitsPoints->isChecked () )
372
- {
373
- myTypeInt = QgsLabelAttributes::PointUnits;
374
- }
375
- else // assume map units is checked
376
- {
377
- myTypeInt = QgsLabelAttributes::MapUnits;
378
- }
350
+ int myTypeInt = cboFontSizeUnits->currentIndex () == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
379
351
myLabelAttributes->setSize ( mFont .pointSizeF (), myTypeInt );
380
352
myLabelAttributes->setBold ( mFont .bold () );
381
353
myLabelAttributes->setItalic ( mFont .italic () );
382
354
myLabelAttributes->setUnderline ( mFont .underline () );
383
355
myLabelAttributes->setStrikeOut ( mFont .strikeOut () );
384
356
myLabelAttributes->setColor ( mFontColor );
385
- myTypeInt = 0 ;
386
- if ( radioOffsetUnitsPoints->isChecked () )
387
- {
388
- myTypeInt = QgsLabelAttributes::PointUnits;
389
- }
390
- else
391
- {
392
- myTypeInt = QgsLabelAttributes::MapUnits;
393
- }
357
+ myTypeInt = cboOffsetUnits->currentIndex () == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
394
358
myLabelAttributes->setOffset ( spinXOffset->value (), spinYOffset->value (), myTypeInt );
395
359
myLabelAttributes->setAutoAngle ( spinAngle->value () == -1 );
396
360
myLabelAttributes->setAngle ( spinAngle->value () );
@@ -411,15 +375,7 @@ void QgsLabelDialog::apply()
411
375
myLabelAttributes->setMultilineEnabled ( chkUseMultiline->isChecked () );
412
376
myLabelAttributes->setBufferEnabled ( chkUseBuffer->isChecked () );
413
377
myLabelAttributes->setBufferColor ( mBufferColor );
414
- myTypeInt = 0 ;
415
- if ( radioBufferUnitsPoints->isChecked () )
416
- {
417
- myTypeInt = QgsLabelAttributes::PointUnits;
418
- }
419
- else
420
- {
421
- myTypeInt = QgsLabelAttributes::MapUnits;
422
- }
378
+ myTypeInt = cboBufferSizeUnits->currentIndex () == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
423
379
myLabelAttributes->setBufferSize ( spinBufferSize->value (), myTypeInt );
424
380
// TODO - transparency attributes for buffers
425
381
0 commit comments