17#include "moc_qgsscalerangewidget.cpp"
28 mLayout =
new QGridLayout(
this );
29 mLayout->setContentsMargins( 0, 0, 0, 0 );
31 QLabel *minLbl =
new QLabel( tr(
"Minimum (exclusive)" ),
this );
32 minLbl->setWordWrap(
true );
33 minLbl->setAlignment( Qt::AlignTop );
34 minLbl->setToolTip( tr(
"Minimum scale, i.e. most \"zoomed out\". "
35 "This limit is exclusive, that means the layer will not be displayed on this scale." ) );
36 QLabel *maxLbl =
new QLabel( tr(
"Maximum (inclusive)" ),
this );
37 maxLbl->setWordWrap(
true );
38 maxLbl->setAlignment( Qt::AlignTop );
39 maxLbl->setToolTip( tr(
"Maximum scale, i.e. most \"zoomed in\". "
40 "This limit is inclusive, that means the layer will be displayed on this scale." ) );
43 mMinimumScaleIconLabel =
new QLabel(
this );
44 mMinimumScaleIconLabel->setPixmap(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionZoomOut.svg" ) ).pixmap( QSize( iconSize, iconSize ) ) );
45 mMaximumScaleIconLabel =
new QLabel(
this );
46 mMaximumScaleIconLabel->setPixmap(
QgsApplication::getThemeIcon( QStringLiteral(
"/mActionZoomIn.svg" ) ).pixmap( QSize( iconSize, iconSize ) ) );
55 mMinimumScaleWidget->
setScale( 100000 );
56 mMaximumScaleWidget->
setScale( 1000 );
58 mLayout->addWidget( minLbl, 0, 0, 1, 2 );
59 mLayout->addWidget( mMinimumScaleIconLabel, 1, 0 );
60 mLayout->addWidget( mMinimumScaleWidget, 1, 1 );
61 mLayout->addWidget( maxLbl, 0, 2, 1, 2 );
62 mLayout->addWidget( mMaximumScaleIconLabel, 1, 2 );
63 mLayout->addWidget( mMaximumScaleWidget, 1, 3 );
65 mLayout->setColumnStretch( 0, 0 );
66 mLayout->setColumnStretch( 1, 3 );
67 mLayout->setColumnStretch( 2, 0 );
68 mLayout->setColumnStretch( 3, 3 );
92 mMinimumScaleWidget->
setScale( scale );
97 return mMinimumScaleWidget->
scale();
102 mMaximumScaleWidget->
setScale( scale );
107 return mMaximumScaleWidget->
scale();
116void QgsScaleRangeWidget::emitRangeChanged()
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Map canvas is a class for displaying all GIS data types on a canvas.
QVector< double > mapScales() const
Returns the list of custom project map scales.
static QgsProject * instance()
Returns the QgsProject singleton instance.
const QgsProjectViewSettings * viewSettings() const
Returns the project's view settings, which contains settings and properties relating to how a QgsProj...
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...