QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
27 mLayout =
new QGridLayout(
this );
28 mLayout->setContentsMargins( 0, 0, 0, 0 );
30 QLabel *minLbl =
new QLabel( tr(
"Minimum (exclusive)" ),
this );
31 minLbl->setWordWrap(
true );
32 minLbl->setAlignment( Qt::AlignTop );
33 minLbl->setToolTip( tr(
"Minimum scale, i.e. most \"zoomed out\". "
34 "This limit is exclusive, that means the layer will not be displayed on this scale." ) );
35 QLabel *maxLbl =
new QLabel( tr(
"Maximum (inclusive)" ),
this );
36 maxLbl->setWordWrap(
true );
37 maxLbl->setAlignment( Qt::AlignTop );
38 maxLbl->setToolTip( tr(
"Maximum scale, i.e. most \"zoomed in\". "
39 "This limit is inclusive, that means the layer will be displayed on this scale." ) );
42 mMinimumScaleIconLabel =
new QLabel(
this );
44 mMaximumScaleIconLabel =
new QLabel(
this );
54 mMinimumScaleWidget->
setScale( 100000 );
55 mMaximumScaleWidget->
setScale( 1000 );
57 mLayout->addWidget( minLbl, 0, 0, 1, 2 );
58 mLayout->addWidget( mMinimumScaleIconLabel, 1, 0 );
59 mLayout->addWidget( mMinimumScaleWidget, 1, 1 );
60 mLayout->addWidget( maxLbl, 0, 2, 1, 2 );
61 mLayout->addWidget( mMaximumScaleIconLabel, 1, 2 );
62 mLayout->addWidget( mMaximumScaleWidget, 1, 3 );
64 mLayout->setColumnStretch( 0, 0 );
65 mLayout->setColumnStretch( 1, 3 );
66 mLayout->setColumnStretch( 2, 0 );
67 mLayout->setColumnStretch( 3, 3 );
78 QStringList scalesList;
80 scalesList.reserve( projectScales.size() );
81 for (
double scale : projectScales )
82 scalesList << QStringLiteral(
"1:%1" ).arg( scale );
96 mMinimumScaleWidget->
setScale( scale );
101 return mMinimumScaleWidget->
scale();
106 mMaximumScaleWidget->
setScale( scale );
111 return mMaximumScaleWidget->
scale();
120 void QgsScaleRangeWidget::emitRangeChanged()
const QgsProjectViewSettings * viewSettings() const
Returns the project's view settings, which contains settings and properties relating to how a QgsProj...
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
QVector< double > mapScales() const
Returns the list of custom project map scales.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
bool useProjectScales() const
Returns true if project mapScales() are enabled.