25 mComboBoxMinScale->setScale( 0.0000001 );
26 mComboBoxMaxScale->setScale( 1 );
27 connect( mCheckBoxMinScale, SIGNAL( toggled(
bool ) ),
this, SLOT( configureMinComboBox() ) );
28 connect( mCheckBoxMaxScale, SIGNAL( toggled(
bool ) ),
this, SLOT( configureMaxComboBox() ) );
29 connect( mComboBoxMinScale, SIGNAL( scaleChanged() ),
this, SLOT( configureMaxComboBox() ) );
30 connect( mComboBoxMaxScale, SIGNAL( scaleChanged() ),
this, SLOT( configureMinComboBox() ) );
35 mComboBoxMinScale->setScale( scale.
minScale > 0.0 ? scale.
minScale : 0.0000001 );
36 mCheckBoxMinScale->setChecked( scale.
minScale > 0.0 );
37 mComboBoxMinScale->setEnabled( scale.
minScale > 0.0 );
39 mCheckBoxMaxScale->setChecked( scale.
maxScale > 0.0 );
40 mComboBoxMaxScale->setEnabled( scale.
maxScale > 0.0 );
43 void QgsMapUnitScaleDialog::configureMinComboBox()
45 mComboBoxMinScale->setEnabled( mCheckBoxMinScale->isChecked() );
46 if ( mCheckBoxMinScale->isChecked() && mComboBoxMinScale->scale() > mComboBoxMaxScale->scale() )
48 mComboBoxMinScale->setScale( mComboBoxMaxScale->scale() );
52 void QgsMapUnitScaleDialog::configureMaxComboBox()
54 mComboBoxMaxScale->setEnabled( mCheckBoxMaxScale->isChecked() );
55 if ( mCheckBoxMaxScale->isChecked() && mComboBoxMaxScale->scale() < mComboBoxMinScale->scale() )
57 mComboBoxMaxScale->setScale( mComboBoxMinScale->scale() );
64 scale.
minScale = mCheckBoxMinScale->isChecked() ? mComboBoxMinScale->scale() : 0;
65 scale.
maxScale = mCheckBoxMaxScale->isChecked() ? mComboBoxMaxScale->scale() : 0;
77 mMapScaleButton->setVisible(
false );
78 mMapScaleButton->setToolTip(
tr(
"Adjust scaling range" ) );
80 setFocusPolicy( Qt::StrongFocus );
81 setFocusProxy( mUnitCombo );
83 connect( mUnitCombo, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( toggleUnitRangeButton() ) );
84 connect( mMapScaleButton, SIGNAL( clicked() ),
this, SLOT( showDialog() ) );
85 connect( mUnitCombo, SIGNAL( currentIndexChanged(
int ) ),
this, SIGNAL(
changed() ) );
91 mUnitCombo->addItems( units );
92 mMapUnitIdx = mapUnitIdx;
93 blockSignals(
false );
99 mUnitCombo->setCurrentIndex( unitIndex );
100 blockSignals(
false );
103 void QgsUnitSelectionWidget::showDialog()
106 if ( mUnitScaleDialog->exec() != QDialog::Accepted )
120 void QgsUnitSelectionWidget::toggleUnitRangeButton()
122 mMapScaleButton->setVisible( mMapUnitIdx != -1 && mUnitCombo->currentIndex() == mMapUnitIdx );
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
QgsMapUnitScaleDialog(QWidget *parent)
double maxScale
The maximum scale, or 0.0 if unset.
void setMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale.
Dialog allowing the user to choose the minimum and maximum scale of an object in map units...
Struct for storing maximum and minimum scales for measurements in map units.
double minScale
The minimum scale, or 0.0 if unset.