25   mComboBoxMinScale->setScale( 0.0000001 );
    26   mComboBoxMaxScale->setScale( 1 );
    27   mSpinBoxMinSize->setShowClearButton( 
false );
    28   mSpinBoxMaxSize->setShowClearButton( 
false );
    29   connect( mCheckBoxMinScale, SIGNAL( toggled( 
bool ) ), 
this, SLOT( configureMinComboBox() ) );
    30   connect( mCheckBoxMaxScale, SIGNAL( toggled( 
bool ) ), 
this, SLOT( configureMaxComboBox() ) );
    31   connect( mComboBoxMinScale, SIGNAL( scaleChanged( 
double ) ), 
this, SLOT( configureMaxComboBox() ) );
    32   connect( mComboBoxMinScale, SIGNAL( scaleChanged( 
double ) ), mComboBoxMaxScale, SLOT( setMinScale( 
double ) ) );
    33   connect( mComboBoxMaxScale, SIGNAL( scaleChanged( 
double ) ), 
this, SLOT( configureMinComboBox() ) );
    35   connect( mCheckBoxMinSize, SIGNAL( toggled( 
bool ) ), mSpinBoxMinSize, SLOT( 
setEnabled( 
bool ) ) );
    36   connect( mCheckBoxMaxSize, SIGNAL( toggled( 
bool ) ), mSpinBoxMaxSize, SLOT( 
setEnabled( 
bool ) ) );
    41   mComboBoxMinScale->setScale( scale.
minScale > 0.0 ? scale.
minScale : 0.0000001 );
    42   mCheckBoxMinScale->setChecked( scale.
minScale > 0.0 );
    43   mComboBoxMinScale->setEnabled( scale.
minScale > 0.0 );
    45   mCheckBoxMaxScale->setChecked( scale.
maxScale > 0.0 );
    46   mComboBoxMaxScale->setEnabled( scale.
maxScale > 0.0 );
    50   mSpinBoxMinSize->setValue( scale.
minSizeMM );
    54   mSpinBoxMaxSize->setValue( scale.
maxSizeMM );
    59   mComboBoxMinScale->setMapCanvas( canvas );
    60   mComboBoxMinScale->setShowCurrentScaleButton( 
true );
    61   mComboBoxMaxScale->setMapCanvas( canvas );
    62   mComboBoxMaxScale->setShowCurrentScaleButton( 
true );
    65 void QgsMapUnitScaleDialog::configureMinComboBox()
    67   mComboBoxMinScale->setEnabled( mCheckBoxMinScale->isChecked() );
    68   if ( mCheckBoxMinScale->isChecked() && mComboBoxMinScale->scale() > mComboBoxMaxScale->scale() )
    70     mComboBoxMinScale->setScale( mComboBoxMaxScale->scale() );
    74 void QgsMapUnitScaleDialog::configureMaxComboBox()
    76   mComboBoxMaxScale->setEnabled( mCheckBoxMaxScale->isChecked() );
    77   if ( mCheckBoxMaxScale->isChecked() && mComboBoxMaxScale->scale() < mComboBoxMinScale->scale() )
    79     mComboBoxMaxScale->setScale( mComboBoxMinScale->scale() );
    86   scale.
minScale = mCheckBoxMinScale->isChecked() ? mComboBoxMinScale->scale() : 0;
    87   scale.
maxScale = mCheckBoxMaxScale->isChecked() ? mComboBoxMaxScale->scale() : 0;
    89   scale.
minSizeMM = mSpinBoxMinSize->value();
    91   scale.
maxSizeMM = mSpinBoxMaxSize->value();
   102   mMapScaleButton->setVisible( 
false );
   103   mMapScaleButton->setToolTip( 
tr( 
"Adjust scaling range" ) );
   108   connect( mUnitCombo, SIGNAL( currentIndexChanged( 
int ) ), 
this, SLOT( toggleUnitRangeButton() ) );
   109   connect( mMapScaleButton, SIGNAL( clicked() ), 
this, SLOT( showDialog() ) );
   110   connect( mUnitCombo, SIGNAL( currentIndexChanged( 
int ) ), 
this, SIGNAL( 
changed() ) );
   116   mUnitCombo->addItems( units );
   117   mMapUnitIdx = mapUnitIdx;
   151   if ( mUnitCombo->count() == 0 )
   154   QVariant currentData = mUnitCombo->itemData( mUnitCombo->currentIndex() );
   166   mUnitCombo->setCurrentIndex( unitIndex );
   172   int idx = mUnitCombo->findData( 
QVariant(( 
int ) unit ) );
   173   mUnitCombo->setCurrentIndex( idx == -1 ? 0 : idx );
   181 void QgsUnitSelectionWidget::showDialog()
   184   if ( mUnitScaleDialog->
exec() != QDialog::Accepted )
   191     if ( scale != newScale )
   198 void QgsUnitSelectionWidget::toggleUnitRangeButton()
   206     mMapScaleButton->setVisible( mMapUnitIdx != -1 && mUnitCombo->currentIndex() == mMapUnitIdx );
 
double minSizeMM
The minimum size in millimeters, or 0.0 if unset. 
OutputUnit
The unit of the output. 
The output shall be in pixels. 
QgsMapUnitScaleDialog(QWidget *parent=nullptr)
QString tr(const char *sourceText, const char *disambiguation, int n)
Map canvas is a class for displaying all GIS data types on a canvas. 
double maxScale
The maximum scale, or 0.0 if unset. 
bool minSizeMMEnabled
Whether the minimum size in mm should be respected. 
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale. 
Mixed units in symbol layers. 
The output shall be in millimeters. 
int toInt(bool *ok) const
The ouput shall be a percentage of another measurement (eg canvas size, feature size) ...
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...
The output shall be in map unitx. 
bool blockSignals(bool block)
bool contains(const T &value) const
double maxSizeMM
The maximum size in millimeters, or 0.0 if unset. 
Struct for storing maximum and minimum scales for measurements in map units. 
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog. 
double minScale
The minimum scale, or 0.0 if unset. 
bool maxSizeMMEnabled
Whether the maximum size in mm should be respected.