Skip to content

Commit 1b9999d

Browse files
author
jef
committed
allow entry of visibility scales in floating point
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12661 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 119061e commit 1b9999d

6 files changed

+52
-107
lines changed

src/app/qgslabeldialog.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
* *
1515
***************************************************************************/
1616
/* $Id$ */
17+
18+
#include <limits>
19+
1720
#include "qgslabeldialog.h"
1821
#include "qgsfield.h"
1922
#include "qgslabel.h"
2023
#include "qgslabelattributes.h"
24+
#include "qgslogger.h"
2125

2226
#include <QColorDialog>
2327
#include <QFontDialog>
2428
#include <QTabWidget>
25-
#include "qgslogger.h"
29+
#include <QDoubleValidator>
2630

2731

2832
const int PIXMAP_WIDTH = 200;
@@ -146,8 +150,10 @@ void QgsLabelDialog::init( )
146150

147151
// set up the scale based layer visibility stuff....
148152
chkUseScaleDependentRendering->setChecked( mLabel->scaleBasedVisibility() );
149-
spinMinimumScale->setValue(( int )mLabel->minScale() );
150-
spinMaximumScale->setValue(( int )mLabel->maxScale() );
153+
leMinimumScale->setText( QString::number( mLabel->minScale(), 'f' ) );
154+
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
155+
leMaximumScale->setText( QString::number( mLabel->maxScale(), 'f' ) );
156+
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
151157

152158
//
153159
//set the non-databound fields up now
@@ -438,8 +444,8 @@ void QgsLabelDialog::apply()
438444

439445
// set up the scale based layer visibility stuff....
440446
mLabel->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
441-
mLabel->setMinScale( spinMinimumScale->value() );
442-
mLabel->setMaxScale( spinMaximumScale->value() );
447+
mLabel->setMinScale( leMinimumScale->text().toFloat() );
448+
mLabel->setMaxScale( leMaximumScale->text().toFloat() );
443449
}
444450

445451
int QgsLabelDialog::fieldIndexFromName( QString name )

src/app/qgsrasterlayerproperties.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* *
1616
***************************************************************************/
1717

18-
#include <QDebug>
18+
#include <limits>
1919

2020
#include "qgslogger.h"
2121
#include "qgsapplication.h"
@@ -98,8 +98,10 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QWidget *p
9898

9999
// set up the scale based layer visibility stuff....
100100
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
101-
spinMinimumScale->setValue(( int )lyr->minimumScale() );
102-
spinMaximumScale->setValue(( int )lyr->maximumScale() );
101+
leMinimumScale->setText( QString::number( lyr->minimumScale(), 'f' ) );
102+
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
103+
leMaximumScale->setText( QString::number( lyr->maximumScale(), 'f' ) );
104+
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
103105

104106
// build GUI components
105107
cboxColorMap->addItem( tr( "Grayscale" ) );
@@ -1446,8 +1448,8 @@ void QgsRasterLayerProperties::apply()
14461448

14471449
// set up the scale based layer visibility stuff....
14481450
mRasterLayer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
1449-
mRasterLayer->setMinimumScale( spinMinimumScale->value() );
1450-
mRasterLayer->setMaximumScale( spinMaximumScale->value() );
1451+
mRasterLayer->setMinimumScale( leMinimumScale->text().toFloat() );
1452+
mRasterLayer->setMaximumScale( leMaximumScale->text().toFloat() );
14511453

14521454
//update the legend pixmap
14531455
pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );

src/app/qgsvectorlayerproperties.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/* $Id$ */
1919

2020
#include <memory>
21+
#include <limits>
2122

2223
#include "qgisapp.h"
2324
#include "qgsapplication.h"
@@ -476,8 +477,10 @@ void QgsVectorLayerProperties::reset( void )
476477

477478
// set up the scale based layer visibility stuff....
478479
chkUseScaleDependentRendering->setChecked( layer->hasScaleBasedVisibility() );
479-
spinMinimumScale->setValue(( int )layer->minimumScale() );
480-
spinMaximumScale->setValue(( int )layer->maximumScale() );
480+
leMinimumScale->setText( QString::number( layer->minimumScale(), 'f' ) );
481+
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
482+
leMaximumScale->setText( QString::number( layer->maximumScale(), 'f' ) );
483+
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
481484

482485
// symbology initialization
483486
if ( legendtypecombobox->count() == 0 )
@@ -570,8 +573,8 @@ void QgsVectorLayerProperties::apply()
570573

571574
// set up the scale based layer visibility stuff....
572575
layer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
573-
layer->setMinimumScale( spinMinimumScale->value() );
574-
layer->setMaximumScale( spinMaximumScale->value() );
576+
layer->setMinimumScale( leMinimumScale->text().toFloat() );
577+
layer->setMaximumScale( leMaximumScale->text().toFloat() );
575578

576579
// update the display field
577580
layer->setDisplayField( displayFieldComboBox->currentText() );

src/ui/qgslabeldialogbase.ui

+4-30
Original file line numberDiff line numberDiff line change
@@ -304,46 +304,20 @@
304304
<property name="text">
305305
<string>Maximum</string>
306306
</property>
307-
<property name="buddy">
308-
<cstring>spinMaximumScale</cstring>
309-
</property>
310307
</widget>
311308
</item>
312309
<item row="0" column="0">
313310
<widget class="QLabel" name="textLabel1_1">
314311
<property name="text">
315312
<string>Minimum</string>
316313
</property>
317-
<property name="buddy">
318-
<cstring>spinMinimumScale</cstring>
319-
</property>
320314
</widget>
321315
</item>
322316
<item row="0" column="1">
323-
<widget class="QSpinBox" name="spinMinimumScale">
324-
<property name="toolTip">
325-
<string>Minimum scale at which this layer will be displayed. </string>
326-
</property>
327-
<property name="minimum">
328-
<number>1</number>
329-
</property>
330-
<property name="maximum">
331-
<number>100000000</number>
332-
</property>
333-
</widget>
317+
<widget class="QLineEdit" name="leMinimumScale"/>
334318
</item>
335319
<item row="0" column="3">
336-
<widget class="QSpinBox" name="spinMaximumScale">
337-
<property name="toolTip">
338-
<string>Maximum scale at which this layer will be displayed. </string>
339-
</property>
340-
<property name="minimum">
341-
<number>1</number>
342-
</property>
343-
<property name="maximum">
344-
<number>100000000</number>
345-
</property>
346-
</widget>
320+
<widget class="QLineEdit" name="leMaximumScale"/>
347321
</item>
348322
</layout>
349323
</widget>
@@ -947,8 +921,8 @@
947921
<tabstop>radioBelowLeft</tabstop>
948922
<tabstop>radioBelow</tabstop>
949923
<tabstop>radioBelowRight</tabstop>
950-
<tabstop>spinMinimumScale</tabstop>
951-
<tabstop>spinMaximumScale</tabstop>
924+
<tabstop>leMinimumScale</tabstop>
925+
<tabstop>leMaximumScale</tabstop>
952926
<tabstop>pbnDefaultBufferColor_2</tabstop>
953927
<tabstop>spinBufferSize</tabstop>
954928
<tabstop>radioBufferUnitsPoints</tabstop>

src/ui/qgsrasterlayerpropertiesbase.ui

+16-30
Original file line numberDiff line numberDiff line change
@@ -1569,46 +1569,32 @@
15691569
<property name="margin">
15701570
<number>11</number>
15711571
</property>
1572-
<item row="0" column="3">
1573-
<widget class="QSpinBox" name="spinMaximumScale">
1574-
<property name="toolTip">
1575-
<string>Maximum scale at which this layer will be displayed. </string>
1576-
</property>
1577-
<property name="minimum">
1578-
<number>1</number>
1579-
</property>
1580-
<property name="maximum">
1581-
<number>100000000</number>
1582-
</property>
1583-
</widget>
1584-
</item>
15851572
<item row="0" column="2">
15861573
<widget class="QLabel" name="textLabel1_2_2_2">
1574+
<property name="layoutDirection">
1575+
<enum>Qt::RightToLeft</enum>
1576+
</property>
15871577
<property name="text">
15881578
<string>Maximum</string>
15891579
</property>
15901580
</widget>
15911581
</item>
1592-
<item row="0" column="1">
1593-
<widget class="QSpinBox" name="spinMinimumScale">
1594-
<property name="toolTip">
1595-
<string>Minimum scale at which this layer will be displayed. </string>
1596-
</property>
1597-
<property name="minimum">
1598-
<number>1</number>
1599-
</property>
1600-
<property name="maximum">
1601-
<number>100000000</number>
1602-
</property>
1603-
</widget>
1604-
</item>
16051582
<item row="0" column="0">
16061583
<widget class="QLabel" name="textLabel1_3">
1584+
<property name="layoutDirection">
1585+
<enum>Qt::RightToLeft</enum>
1586+
</property>
16071587
<property name="text">
16081588
<string>Minimum</string>
16091589
</property>
16101590
</widget>
16111591
</item>
1592+
<item row="0" column="3">
1593+
<widget class="QLineEdit" name="leMaximumScale"/>
1594+
</item>
1595+
<item row="0" column="1">
1596+
<widget class="QLineEdit" name="leMinimumScale"/>
1597+
</item>
16121598
</layout>
16131599
</widget>
16141600
</item>
@@ -1824,8 +1810,8 @@
18241810
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
18251811
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
18261812
p, li { white-space: pre-wrap; }
1827-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
1828-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1813+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
1814+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
18291815
</property>
18301816
</widget>
18311817
</item>
@@ -2114,8 +2100,8 @@ p, li { white-space: pre-wrap; }
21142100
<tabstop>tableTransparency</tabstop>
21152101
<tabstop>leDisplayName</tabstop>
21162102
<tabstop>leLayerSource</tabstop>
2117-
<tabstop>spinMinimumScale</tabstop>
2118-
<tabstop>spinMaximumScale</tabstop>
2103+
<tabstop>leMinimumScale</tabstop>
2104+
<tabstop>leMaximumScale</tabstop>
21192105
<tabstop>leSpatialRefSys</tabstop>
21202106
<tabstop>pbnChangeSpatialRefSys</tabstop>
21212107
<tabstop>tePyramidDescription</tabstop>

src/ui/qgsvectorlayerpropertiesbase.ui

+7-33
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
<item row="0" column="1">
143143
<widget class="QStackedWidget" name="stackedWidget">
144144
<property name="currentIndex">
145-
<number>0</number>
145+
<number>3</number>
146146
</property>
147147
<widget class="QWidget" name="page_3">
148148
<layout class="QGridLayout" name="gridLayout_4">
@@ -423,8 +423,8 @@
423423
<rect>
424424
<x>0</x>
425425
<y>0</y>
426-
<width>401</width>
427-
<height>425</height>
426+
<width>514</width>
427+
<height>428</height>
428428
</rect>
429429
</property>
430430
<layout class="QGridLayout" name="gridLayout_3">
@@ -548,46 +548,20 @@
548548
<property name="text">
549549
<string>Maximum</string>
550550
</property>
551-
<property name="buddy">
552-
<cstring>spinMaximumScale</cstring>
553-
</property>
554551
</widget>
555552
</item>
556553
<item row="0" column="0">
557554
<widget class="QLabel" name="textLabel1">
558555
<property name="text">
559556
<string>Minimum</string>
560557
</property>
561-
<property name="buddy">
562-
<cstring>spinMinimumScale</cstring>
563-
</property>
564558
</widget>
565559
</item>
566560
<item row="0" column="1">
567-
<widget class="QSpinBox" name="spinMinimumScale">
568-
<property name="toolTip">
569-
<string>Minimum scale at which this layer will be displayed. </string>
570-
</property>
571-
<property name="minimum">
572-
<number>1</number>
573-
</property>
574-
<property name="maximum">
575-
<number>100000000</number>
576-
</property>
577-
</widget>
561+
<widget class="QLineEdit" name="leMinimumScale"/>
578562
</item>
579563
<item row="0" column="3">
580-
<widget class="QSpinBox" name="spinMaximumScale">
581-
<property name="toolTip">
582-
<string>Maximum scale at which this layer will be displayed. </string>
583-
</property>
584-
<property name="minimum">
585-
<number>1</number>
586-
</property>
587-
<property name="maximum">
588-
<number>100000000</number>
589-
</property>
590-
</widget>
564+
<widget class="QLineEdit" name="leMaximumScale"/>
591565
</item>
592566
</layout>
593567
</widget>
@@ -732,8 +706,8 @@
732706
<tabstop>displayFieldComboBox</tabstop>
733707
<tabstop>leSpatialRefSys</tabstop>
734708
<tabstop>pbnIndex</tabstop>
735-
<tabstop>spinMinimumScale</tabstop>
736-
<tabstop>spinMaximumScale</tabstop>
709+
<tabstop>leMinimumScale</tabstop>
710+
<tabstop>leMaximumScale</tabstop>
737711
<tabstop>txtSubsetSQL</tabstop>
738712
<tabstop>pbnQueryBuilder</tabstop>
739713
<tabstop>buttonBox</tabstop>

0 commit comments

Comments
 (0)