40#include <QStringListModel>
45 , mMapCanvas( mapCanvas )
50 connect( mScaleLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mScaleLineEdit_editingFinished );
51 connect( mActionSetToCanvasExtent, &QAction::triggered,
this, &QgsLayoutMapWidget::setToMapCanvasExtent );
52 connect( mActionViewExtentInCanvas, &QAction::triggered,
this, &QgsLayoutMapWidget::viewExtentInCanvas );
53 connect( mActionSetToCanvasScale, &QAction::triggered,
this, &QgsLayoutMapWidget::setToMapCanvasScale );
54 connect( mActionViewScaleInCanvas, &QAction::triggered,
this, &QgsLayoutMapWidget::viewScaleInCanvas );
55 connect( mActionUpdatePreview, &QAction::triggered,
this, &QgsLayoutMapWidget::updatePreview );
56 connect( mFollowVisibilityPresetCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mFollowVisibilityPresetCheckBox_stateChanged );
57 connect( mKeepLayerListCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mKeepLayerListCheckBox_stateChanged );
58 connect( mKeepLayerStylesCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mKeepLayerStylesCheckBox_stateChanged );
59 connect( mDrawCanvasItemsCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mDrawCanvasItemsCheckBox_stateChanged );
60 connect( mOverviewBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::mOverviewBlendModeComboBox_currentIndexChanged );
61 connect( mOverviewInvertCheckbox, &QCheckBox::toggled,
this, &QgsLayoutMapWidget::mOverviewInvertCheckbox_toggled );
62 connect( mOverviewCenterCheckbox, &QCheckBox::toggled,
this, &QgsLayoutMapWidget::mOverviewCenterCheckbox_toggled );
63 connect( mOverviewPositionComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::overviewStackingChanged );
65 connect( mXMinLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mXMinLineEdit_editingFinished );
66 connect( mXMaxLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mXMaxLineEdit_editingFinished );
67 connect( mYMinLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mYMinLineEdit_editingFinished );
68 connect( mYMaxLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mYMaxLineEdit_editingFinished );
69 connect( mAtlasMarginRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasMarginRadio_toggled );
70 connect( mAtlasCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mAtlasCheckBox_toggled );
71 connect( mAtlasMarginSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::mAtlasMarginSpinBox_valueChanged );
72 connect( mAtlasFixedScaleRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasFixedScaleRadio_toggled );
73 connect( mAtlasPredefinedScaleRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasPredefinedScaleRadio_toggled );
74 connect( mAddGridPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mAddGridPushButton_clicked );
75 connect( mRemoveGridPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mRemoveGridPushButton_clicked );
76 connect( mCopyGridPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mCopyGridPushButton_clicked );
77 connect( mGridUpButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridUpButton_clicked );
78 connect( mGridDownButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridDownButton_clicked );
79 connect( mGridListWidget, &QListWidget::currentItemChanged,
this, &QgsLayoutMapWidget::mGridListWidget_currentItemChanged );
80 connect( mGridListWidget, &QListWidget::itemChanged,
this, &QgsLayoutMapWidget::mGridListWidget_itemChanged );
81 connect( mGridPropertiesButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridPropertiesButton_clicked );
82 connect( mAddOverviewPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mAddOverviewPushButton_clicked );
83 connect( mRemoveOverviewPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mRemoveOverviewPushButton_clicked );
84 connect( mOverviewUpButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mOverviewUpButton_clicked );
85 connect( mOverviewDownButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mOverviewDownButton_clicked );
86 connect( mOverviewCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mOverviewCheckBox_toggled );
87 connect( mOverviewListWidget, &QListWidget::currentItemChanged,
this, &QgsLayoutMapWidget::mOverviewListWidget_currentItemChanged );
88 connect( mOverviewListWidget, &QListWidget::itemChanged,
this, &QgsLayoutMapWidget::mOverviewListWidget_itemChanged );
89 connect( mActionLabelSettings, &QAction::triggered,
this, &QgsLayoutMapWidget::showLabelSettings );
90 connect( mActionClipSettings, &QAction::triggered,
this, &QgsLayoutMapWidget::showClipSettings );
92 connect( mTemporalCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mTemporalCheckBox_toggled );
93 connect( mStartDateTime, &QDateTimeEdit::dateTimeChanged,
this, &QgsLayoutMapWidget::updateTemporalExtent );
94 connect( mEndDateTime, &QDateTimeEdit::dateTimeChanged,
this, &QgsLayoutMapWidget::updateTemporalExtent );
98 connect( mElevationRangeCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mElevationRangeCheckBox_toggled );
99 connect( mZLowerSpin, qOverload< double >( &QgsDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::updateZRange );
100 connect( mZUpperSpin, qOverload< double >( &QgsDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::updateZRange );
102 mStartDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
103 mEndDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
104 mStartDateTime->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
105 mEndDateTime->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
107 connect( mActionMoveContent, &QAction::triggered,
this, &QgsLayoutMapWidget::switchToMoveContentTool );
109 mMapRotationSpinBox->setClearValue( 0 );
113 mBookmarkMenu =
new QMenu(
this );
114 QToolButton *btnBookmarks =
new QToolButton(
this );
115 btnBookmarks->setAutoRaise(
true );
116 btnBookmarks->setToolTip( tr(
"Bookmarks" ) );
118 btnBookmarks->setPopupMode( QToolButton::InstantPopup );
119 btnBookmarks->setMenu( mBookmarkMenu );
121 mDockToolbar->insertWidget( mActionMoveContent, btnBookmarks );
122 connect( mBookmarkMenu, &QMenu::aboutToShow,
this, &QgsLayoutMapWidget::aboutToShowBookmarkMenu );
126 mainLayout->addWidget( mItemPropertiesWidget );
128 mScaleLineEdit->setValidator(
new QDoubleValidator( mScaleLineEdit ) );
130 mXMinLineEdit->setValidator(
new QDoubleValidator( mXMinLineEdit ) );
131 mXMaxLineEdit->setValidator(
new QDoubleValidator( mXMaxLineEdit ) );
132 mYMinLineEdit->setValidator(
new QDoubleValidator( mYMinLineEdit ) );
133 mYMaxLineEdit->setValidator(
new QDoubleValidator( mYMaxLineEdit ) );
141 blockAllSignals(
true );
144 mCrsSelector->setNotSetText( tr(
"Use Project CRS" ) );
145 mCrsSelector->setDialogTitle( tr(
"Map Item CRS" ) );
150 mFollowVisibilityPresetCombo->setModel(
new QStringListModel( mFollowVisibilityPresetCombo ) );
151 connect( mFollowVisibilityPresetCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::followVisibilityPresetSelected );
153 this, &QgsLayoutMapWidget::onMapThemesChanged );
154 onMapThemesChanged();
157 QMenu *menuKeepLayers =
new QMenu(
this );
158 mLayerListFromPresetButton->setMenu( menuKeepLayers );
160 mLayerListFromPresetButton->setToolTip( tr(
"Set layer list from a map theme" ) );
161 connect( menuKeepLayers, &QMenu::aboutToShow,
this, &QgsLayoutMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu );
166 this, &QgsLayoutMapWidget::atlasLayerChanged );
170 compositionAtlasToggled( atlas->enabled() );
173 mOverviewFrameMapComboBox->setCurrentLayout( item->
layout() );
175 mOverviewFrameStyleButton->registerExpressionContextGenerator( item );
181 mOverviewFrameStyleButton->registerExpressionContextGenerator( item );
206 loadOverviewEntries();
208 connect( mMapRotationSpinBox,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::rotationChanged );
212 blockAllSignals(
false );
217 if ( mItemPropertiesWidget )
223 mReportTypeString = string;
224 mAtlasCheckBox->setTitle( tr(
"Controlled by %1" ).arg(
string == tr(
"atlas" ) ? tr(
"Atlas" ) : tr(
"Report" ) ) );
225 mAtlasPredefinedScaleRadio->setToolTip( tr(
"Use one of the predefined scales of the project where the %1 feature best fits." ).arg(
string ) );
228 mClipWidget->setReportTypeString(
string );
230 mLabelWidget->setReportTypeString(
string );
251 mMapItem = qobject_cast< QgsLayoutItemMap * >( item );
252 mItemPropertiesWidget->
setItem( mMapItem );
254 mLabelWidget->setItem( mMapItem );
256 mClipWidget->setItem( mMapItem );
263 mOverviewFrameStyleButton->registerExpressionContextGenerator( mMapItem );
287void QgsLayoutMapWidget::compositionAtlasToggled(
bool atlasEnabled )
290 mMapItem && mMapItem->layout() && mMapItem->layout()->reportContext().layer()
293 mAtlasCheckBox->setEnabled(
true );
297 mAtlasCheckBox->setEnabled(
false );
298 mAtlasCheckBox->setChecked(
false );
302void QgsLayoutMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu()
307 QMenu *menu = qobject_cast<QMenu *>( sender() );
313 for (
const QString &presetName : constMapThemes )
315 menu->addAction( presetName,
this, &QgsLayoutMapWidget::keepLayersVisibilityPresetSelected );
318 if ( menu->actions().isEmpty() )
319 menu->addAction( tr(
"No presets defined" ) )->setEnabled(
false );
322void QgsLayoutMapWidget::followVisibilityPresetSelected(
int currentIndex )
327 if ( mBlockThemeComboChanges != 0 )
330 if ( currentIndex == -1 )
334 if ( currentIndex != 0 )
336 presetName = mFollowVisibilityPresetCombo->currentText();
339 if ( presetName == mMapItem->followVisibilityPresetName() )
342 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
343 mFollowVisibilityPresetCheckBox->setChecked(
true );
344 mMapItem->setFollowVisibilityPresetName( presetName );
345 mMapItem->layout()->undoStack()->endCommand();
347 mMapItem->invalidateCache();
350void QgsLayoutMapWidget::keepLayersVisibilityPresetSelected()
352 QAction *action = qobject_cast<QAction *>( sender() );
356 const QString presetName = action->text();
357 const QList<QgsMapLayer *> lst = orderedPresetVisibleLayers( presetName );
360 mKeepLayerListCheckBox->setChecked(
true );
361 mMapItem->setLayers( lst );
363 mKeepLayerStylesCheckBox->setChecked(
true );
365 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
366 mMapItem->setLayerStyleOverrides(
QgsProject::instance()->mapThemeCollection()->mapThemeStyleOverrides( presetName ) );
367 mMapItem->layout()->undoStack()->endCommand();
369 mMapItem->invalidateCache();
373void QgsLayoutMapWidget::onMapThemesChanged()
375 if ( QStringListModel *model = qobject_cast<QStringListModel *>( mFollowVisibilityPresetCombo->model() ) )
377 mBlockThemeComboChanges++;
379 lst.append( tr(
"(none)" ) );
381 model->setStringList( lst );
384 const int presetModelIndex = mFollowVisibilityPresetCombo->findText( mMapItem->followVisibilityPresetName() );
385 mFollowVisibilityPresetCombo->blockSignals(
true );
386 mFollowVisibilityPresetCombo->setCurrentIndex( presetModelIndex != -1 ? presetModelIndex : 0 );
387 mFollowVisibilityPresetCombo->blockSignals(
false );
388 mBlockThemeComboChanges--;
399 if ( mMapItem->presetCrs() ==
crs )
405 bool updateExtent =
false;
412 newExtent = xForm.transformBoundingBox( prevExtent );
420 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map CRS" ) );
421 mMapItem->setCrs(
crs );
423 mMapItem->zoomToExtent( newExtent );
424 mMapItem->layout()->undoStack()->endCommand();
425 mMapItem->invalidateCache();
428void QgsLayoutMapWidget::overviewSymbolChanged()
436 mMapItem->endCommand();
437 mMapItem->invalidateCache();
440void QgsLayoutMapWidget::showLabelSettings()
444 if ( !mReportTypeString.isEmpty() )
445 mLabelWidget->setReportTypeString( mReportTypeString );
450void QgsLayoutMapWidget::showClipSettings()
453 if ( !mReportTypeString.isEmpty() )
454 mClipWidget->setReportTypeString( mReportTypeString );
458void QgsLayoutMapWidget::switchToMoveContentTool()
464void QgsLayoutMapWidget::aboutToShowBookmarkMenu()
466 mBookmarkMenu->clear();
470 if ( !mBookmarkModel )
473 QMap< QString, QMenu * > groupMenus;
474 for (
int i = 0; i < mBookmarkModel->rowCount(); ++i )
477 QMenu *destMenu = mBookmarkMenu;
478 if ( !group.isEmpty() )
480 destMenu = groupMenus.value( group );
483 destMenu =
new QMenu( group, mBookmarkMenu );
484 groupMenus[ group ] = destMenu;
489 connect( action, &QAction::triggered,
this, [ = ]
499 if ( extent.
crs() != mMapItem->crs() )
503 QgsCoordinateTransform xForm( extent.crs(), mMapItem->crs(), QgsProject::instance() );
504 xForm.setBallparkTransformsAreAppropriate( true );
505 newExtent = xForm.transformBoundingBox( newExtent );
514 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
515 mMapItem->zoomToExtent( newExtent );
516 mMapItem->layout()->undoStack()->endCommand();
518 destMenu->addAction( action );
521 QStringList groupKeys = groupMenus.keys();
522 groupKeys.sort( Qt::CaseInsensitive );
523 for (
int i = 0; i < groupKeys.count(); ++i )
525 if ( mBookmarkMenu->actions().value( i ) )
526 mBookmarkMenu->insertMenu( mBookmarkMenu->actions().at( i ), groupMenus.value( groupKeys.at( i ) ) );
528 mBookmarkMenu->addMenu( groupMenus.value( groupKeys.at( i ) ) );
532void QgsLayoutMapWidget::mTemporalCheckBox_toggled(
bool checked )
539 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Toggle Temporal Range" ) );
540 mMapItem->setIsTemporal( checked );
541 mMapItem->layout()->undoStack()->endCommand();
545 whileBlocking( mStartDateTime )->setDateTime( mMapItem->temporalRange().begin() );
546 whileBlocking( mEndDateTime )->setDateTime( mMapItem->temporalRange().end() );
552void QgsLayoutMapWidget::updateTemporalExtent()
559 const QDateTime begin = mStartDateTime->dateTime();
560 const QDateTime end = mEndDateTime->dateTime();
563 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Set Temporal Range" ) );
564 mMapItem->setTemporalRange( range );
565 mMapItem->layout()->undoStack()->endCommand();
570void QgsLayoutMapWidget::mElevationRangeCheckBox_toggled(
bool checked )
577 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Toggle Z Range" ) );
578 mMapItem->setZRangeEnabled( checked );
579 mMapItem->layout()->undoStack()->endCommand();
584void QgsLayoutMapWidget::updateZRange()
591 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Set Z Range" ) );
592 double zLower = mZLowerSpin->value();
593 if ( zLower == mZLowerSpin->clearValue() )
594 zLower = std::numeric_limits< double >::lowest();
595 double zUpper = mZUpperSpin->value();
596 if ( zUpper == mZUpperSpin->clearValue() )
597 zUpper = std::numeric_limits< double >::max();
600 mMapItem->layout()->undoStack()->endCommand();
605void QgsLayoutMapWidget::mAtlasCheckBox_toggled(
bool checked )
612 mAtlasFixedScaleRadio->setEnabled( checked );
613 mAtlasMarginRadio->setEnabled( checked );
615 if ( mAtlasMarginRadio->isEnabled() && mAtlasMarginRadio->isChecked() )
617 mAtlasMarginSpinBox->setEnabled(
true );
621 mAtlasMarginSpinBox->setEnabled(
false );
624 mAtlasPredefinedScaleRadio->setEnabled( checked );
629 if ( mMapItem->layout() )
631 toggleAtlasScalingOptionsByLayerType();
636 if ( !hasPredefinedScales() )
638 mAtlasPredefinedScaleRadio->setEnabled(
false );
641 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Set Atlas Driven" ) );
642 mMapItem->setAtlasDriven( checked );
643 mMapItem->layout()->undoStack()->endCommand();
647void QgsLayoutMapWidget::updateMapForAtlas()
650 if ( mMapItem->atlasDriven() )
657 mMapItem->invalidateCache();
661void QgsLayoutMapWidget::mAtlasMarginRadio_toggled(
bool checked )
663 mAtlasMarginSpinBox->setEnabled( checked );
665 if ( checked && mMapItem )
667 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
669 mMapItem->layout()->undoStack()->endCommand();
674void QgsLayoutMapWidget::mAtlasMarginSpinBox_valueChanged(
int value )
682 mMapItem->setAtlasMargin( value / 100. );
683 mMapItem->layout()->undoStack()->endCommand();
687void QgsLayoutMapWidget::mAtlasFixedScaleRadio_toggled(
bool checked )
696 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
698 mMapItem->layout()->undoStack()->endCommand();
703void QgsLayoutMapWidget::mAtlasPredefinedScaleRadio_toggled(
bool checked )
710 if ( hasPredefinedScales() )
714 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Scales" ) );
716 mMapItem->layout()->undoStack()->endCommand();
724 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
726 mMapItem->layout()->undoStack()->endCommand();
730void QgsLayoutMapWidget::mScaleLineEdit_editingFinished()
737 bool conversionSuccess =
false;
738 const double scaleDenominator = QLocale().toDouble( mScaleLineEdit->text(), &conversionSuccess );
739 if ( !conversionSuccess )
747 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Scale" ) );
748 mMapItem->setScale( scaleDenominator );
749 mMapItem->layout()->undoStack()->endCommand();
752void QgsLayoutMapWidget::rotationChanged(
double value )
760 mMapItem->setMapRotation( value );
761 mMapItem->layout()->undoStack()->endCommand();
762 mMapItem->invalidateCache();
765void QgsLayoutMapWidget::setToMapCanvasExtent()
782 xForm.setBallparkTransformsAreAppropriate(
true );
783 newExtent = xForm.transformBoundingBox( newExtent );
792 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
793 mMapItem->zoomToExtent( newExtent );
794 mMapItem->layout()->undoStack()->endCommand();
797void QgsLayoutMapWidget::setToMapCanvasScale()
804 const double newScale = mMapCanvas->
scale();
806 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Scale" ) );
807 mMapItem->setScale( newScale );
808 mMapItem->layout()->undoStack()->endCommand();
811void QgsLayoutMapWidget::viewExtentInCanvas()
818 const QgsRectangle currentMapExtent = mMapItem->extent();
820 if ( !currentMapExtent.
isEmpty() )
835void QgsLayoutMapWidget::viewScaleInCanvas()
842 const double currentScale = mMapItem->scale();
843 mMapCanvas->
zoomScale( currentScale,
true );
846void QgsLayoutMapWidget::mXMinLineEdit_editingFinished()
848 updateComposerExtentFromGui();
851void QgsLayoutMapWidget::mXMaxLineEdit_editingFinished()
853 updateComposerExtentFromGui();
856void QgsLayoutMapWidget::mYMinLineEdit_editingFinished()
858 updateComposerExtentFromGui();
861void QgsLayoutMapWidget::mYMaxLineEdit_editingFinished()
863 updateComposerExtentFromGui();
866void QgsLayoutMapWidget::updateGuiElements()
873 blockAllSignals(
true );
874 mLabel->setText( mMapItem->displayName() );
876 whileBlocking( mCrsSelector )->setCrs( mMapItem->presetCrs() );
879 const double scale = mMapItem->scale();
882 if ( scale >= 10000 )
885 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 0 ) );
887 else if ( scale >= 10 )
889 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 3 ) );
891 else if ( scale >= 1 )
894 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 4 ) );
899 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 10 ) );
903 const QgsRectangle composerMapExtent = mMapItem->extent();
904 mXMinLineEdit->setText( QLocale().toString( composerMapExtent.
xMinimum(),
'f', 3 ) );
905 mXMaxLineEdit->setText( QLocale().toString( composerMapExtent.
xMaximum(),
'f', 3 ) );
906 mYMinLineEdit->setText( QLocale().toString( composerMapExtent.
yMinimum(),
'f', 3 ) );
907 mYMaxLineEdit->setText( QLocale().toString( composerMapExtent.
yMaximum(),
'f', 3 ) );
912 mFollowVisibilityPresetCheckBox->setCheckState(
913 mMapItem->followVisibilityPreset() ? Qt::Checked : Qt::Unchecked );
914 const int presetModelIndex = mFollowVisibilityPresetCombo->findText( mMapItem->followVisibilityPresetName() );
915 mFollowVisibilityPresetCombo->setCurrentIndex( presetModelIndex != -1 ? presetModelIndex : 0 );
918 if ( mMapItem->keepLayerSet() )
920 mKeepLayerListCheckBox->setCheckState( Qt::Checked );
924 mKeepLayerListCheckBox->setCheckState( Qt::Unchecked );
927 mKeepLayerStylesCheckBox->setEnabled( mMapItem->keepLayerSet() );
928 mKeepLayerStylesCheckBox->setCheckState( mMapItem->keepLayerStyles() ? Qt::Checked : Qt::Unchecked );
931 if ( mMapItem->drawAnnotations() )
933 mDrawCanvasItemsCheckBox->setCheckState( Qt::Checked );
937 mDrawCanvasItemsCheckBox->setCheckState( Qt::Unchecked );
941 mAtlasCheckBox->setChecked( mMapItem->atlasDriven() );
944 mAtlasFixedScaleRadio->setEnabled( mMapItem->atlasDriven() );
947 mAtlasMarginRadio->setEnabled( mMapItem->atlasDriven() );
949 mAtlasPredefinedScaleRadio->setEnabled( mMapItem->atlasDriven() );
952 if ( mMapItem->atlasDriven() )
954 toggleAtlasScalingOptionsByLayerType();
957 if ( !hasPredefinedScales() )
959 mAtlasPredefinedScaleRadio->setEnabled(
false );
962 mTemporalCheckBox->setChecked( mMapItem->isTemporal() );
963 mTemporalCheckBox->setCollapsed( !mMapItem->isTemporal() );
964 mStartDateTime->setEnabled( mMapItem->isTemporal() );
965 mEndDateTime->setEnabled( mMapItem->isTemporal() );
966 if ( mMapItem->isTemporal() )
968 mStartDateTime->setDateTime( mMapItem->temporalRange().begin() );
969 mEndDateTime->setDateTime( mMapItem->temporalRange().end() );
972 whileBlocking( mElevationRangeCheckBox )->setChecked( mMapItem->zRangeEnabled() );
973 mElevationRangeCheckBox->setCollapsed( !mMapItem->zRangeEnabled() );
974 if ( mMapItem->zRange().lower() != std::numeric_limits< double >::lowest() )
975 whileBlocking( mZLowerSpin )->setValue( mMapItem->zRange().lower() );
978 if ( mMapItem->zRange().upper() != std::numeric_limits< double >::max() )
979 whileBlocking( mZUpperSpin )->setValue( mMapItem->zRange().upper() );
985 loadOverviewEntries();
987 blockAllSignals(
false );
990void QgsLayoutMapWidget::toggleAtlasScalingOptionsByLayerType()
1008 mAtlasFixedScaleRadio->setChecked(
true );
1009 mAtlasMarginRadio->setEnabled(
false );
1014 mAtlasMarginRadio->setEnabled(
true );
1018void QgsLayoutMapWidget::updateComposerExtentFromGui()
1025 double xmin, ymin, xmax, ymax;
1026 bool conversionSuccess;
1028 xmin = QLocale().toDouble( mXMinLineEdit->text(), &conversionSuccess );
1029 if ( !conversionSuccess )
1031 xmax = QLocale().toDouble( mXMaxLineEdit->text(), &conversionSuccess );
1032 if ( !conversionSuccess )
1034 ymin = QLocale().toDouble( mYMinLineEdit->text(), &conversionSuccess );
1035 if ( !conversionSuccess )
1037 ymax = QLocale().toDouble( mYMaxLineEdit->text(), &conversionSuccess );
1038 if ( !conversionSuccess )
1041 const QgsRectangle newExtent( xmin, ymin, xmax, ymax );
1043 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
1044 mMapItem->setExtent( newExtent );
1045 mMapItem->layout()->undoStack()->endCommand();
1048void QgsLayoutMapWidget::blockAllSignals(
bool b )
1050 mScaleLineEdit->blockSignals( b );
1051 mXMinLineEdit->blockSignals( b );
1052 mXMaxLineEdit->blockSignals( b );
1053 mYMinLineEdit->blockSignals( b );
1054 mYMaxLineEdit->blockSignals( b );
1055 mDrawCanvasItemsCheckBox->blockSignals( b );
1056 mOverviewFrameMapComboBox->blockSignals( b );
1057 mOverviewFrameStyleButton->blockSignals( b );
1058 mOverviewBlendModeComboBox->blockSignals( b );
1059 mOverviewInvertCheckbox->blockSignals( b );
1060 mOverviewCenterCheckbox->blockSignals( b );
1061 mAtlasCheckBox->blockSignals( b );
1062 mAtlasMarginSpinBox->blockSignals( b );
1063 mAtlasFixedScaleRadio->blockSignals( b );
1064 mAtlasMarginRadio->blockSignals( b );
1065 mFollowVisibilityPresetCheckBox->blockSignals( b );
1066 mFollowVisibilityPresetCombo->blockSignals( b );
1067 mKeepLayerListCheckBox->blockSignals( b );
1068 mKeepLayerStylesCheckBox->blockSignals( b );
1069 mActionSetToCanvasExtent->blockSignals( b );
1070 mActionUpdatePreview->blockSignals( b );
1071 mTemporalCheckBox->blockSignals( b );
1072 mStartDateTime->blockSignals( b );
1073 mEndDateTime->blockSignals( b );
1075 blockOverviewItemsSignals( b );
1078void QgsLayoutMapWidget::updatePreview()
1084 mMapItem->refresh();
1087void QgsLayoutMapWidget::mFollowVisibilityPresetCheckBox_stateChanged(
int state )
1094 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
1095 if ( state == Qt::Checked )
1097 mMapItem->setFollowVisibilityPreset(
true );
1100 mKeepLayerListCheckBox->setCheckState( Qt::Unchecked );
1101 mKeepLayerStylesCheckBox->setCheckState( Qt::Unchecked );
1103 mMapItem->invalidateCache();
1107 mMapItem->setFollowVisibilityPreset(
false );
1109 mMapItem->layout()->undoStack()->endCommand();
1112void QgsLayoutMapWidget::mKeepLayerListCheckBox_stateChanged(
int state )
1120 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Map Preset Changed" ) );
1121 storeCurrentLayerSet();
1122 mMapItem->setKeepLayerSet( state == Qt::Checked );
1123 if ( state == Qt::Unchecked )
1125 mMapItem->setLayers( QList< QgsMapLayer * >() );
1127 mMapItem->layout()->undoStack()->endCommand();
1130 if ( state == Qt::Checked )
1133 mFollowVisibilityPresetCheckBox->setCheckState( Qt::Unchecked );
1137 mKeepLayerStylesCheckBox->setChecked( Qt::Unchecked );
1138 mMapItem->invalidateCache();
1141 mKeepLayerStylesCheckBox->setEnabled( state == Qt::Checked );
1144void QgsLayoutMapWidget::mKeepLayerStylesCheckBox_stateChanged(
int state )
1151 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
1152 if ( state == Qt::Checked )
1154 mMapItem->storeCurrentLayerStyles();
1155 mMapItem->setKeepLayerStyles(
true );
1159 mMapItem->setLayerStyleOverrides( QMap<QString, QString>() );
1160 mMapItem->setKeepLayerStyles(
false );
1162 mMapItem->layout()->undoStack()->endCommand();
1165void QgsLayoutMapWidget::mDrawCanvasItemsCheckBox_stateChanged(
int state )
1172 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Toggle Map Item" ) );
1173 mMapItem->setDrawAnnotations( state == Qt::Checked );
1174 mMapItem->invalidateCache();
1175 mMapItem->layout()->undoStack()->endCommand();
1178void QgsLayoutMapWidget::atlasLayerChanged(
QgsVectorLayer *layer )
1183 mAtlasCheckBox->setChecked(
false );
1184 mAtlasCheckBox->setEnabled(
false );
1189 mAtlasCheckBox->setEnabled(
true );
1193 if ( mAtlasCheckBox->isChecked() )
1194 toggleAtlasScalingOptionsByLayerType();
1197bool QgsLayoutMapWidget::hasPredefinedScales()
const
1202 if ( !hasProjectScales || scales.isEmpty() )
1207 return !scales.isEmpty() && !scales[0].isEmpty();
1212void QgsLayoutMapWidget::mAddGridPushButton_clicked()
1219 const QString itemName = tr(
"Grid %1" ).arg( mMapItem->grids()->size() + 1 );
1221 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Add Map Grid" ) );
1222 mMapItem->grids()->addGrid( grid );
1223 mMapItem->layout()->undoStack()->endCommand();
1224 mMapItem->updateBoundingRect();
1227 addGridListItem( grid->
id(), grid->
name() );
1228 mGridListWidget->setCurrentRow( 0 );
1229 mGridListWidget_currentItemChanged( mGridListWidget->currentItem(),
nullptr );
1232void QgsLayoutMapWidget::mRemoveGridPushButton_clicked()
1234 QListWidgetItem *item = mGridListWidget->currentItem();
1240 mMapItem->beginCommand( tr(
"Remove Grid" ) );
1241 mMapItem->grids()->removeGrid( item->data( Qt::UserRole ).toString() );
1242 QListWidgetItem *delItem = mGridListWidget->takeItem( mGridListWidget->row( item ) );
1244 mMapItem->endCommand();
1245 mMapItem->updateBoundingRect();
1249void QgsLayoutMapWidget::mCopyGridPushButton_clicked()
1251 QListWidgetItem *item = mGridListWidget->currentItem();
1257 QgsLayoutItemMapGrid *sourceGrid = mMapItem->grids()->grid( item->data( Qt::UserRole ).toString() );
1263 QString itemName = tr(
"%1 - Copy" ).arg( sourceGrid->
name() );
1264 QList< QgsLayoutItemMapGrid * > grids = mMapItem->grids()->asList();
1267 const auto it = std::find_if( grids.begin(), grids.end(), [&itemName](
const QgsLayoutItemMapGrid * grd ) { return grd->name() == itemName; } );
1268 if ( it != grids.end() )
1271 itemName = tr(
"%1 - Copy %2" ).arg( sourceGrid->
name() ).arg( i );
1279 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Duplicate Map Grid" ) );
1280 mMapItem->grids()->addGrid( grid );
1281 mMapItem->layout()->undoStack()->endCommand();
1282 mMapItem->updateBoundingRect();
1285 addGridListItem( grid->
id(), grid->
name() );
1286 mGridListWidget->setCurrentRow( 0 );
1287 mGridListWidget_currentItemChanged( mGridListWidget->currentItem(),
nullptr );
1290void QgsLayoutMapWidget::mGridUpButton_clicked()
1292 QListWidgetItem *item = mGridListWidget->currentItem();
1298 const int row = mGridListWidget->row( item );
1303 mGridListWidget->takeItem( row );
1304 mGridListWidget->insertItem( row - 1, item );
1305 mGridListWidget->setCurrentItem( item );
1306 mMapItem->beginCommand( tr(
"Move Grid Up" ) );
1307 mMapItem->grids()->moveGridUp( item->data( Qt::UserRole ).toString() );
1308 mMapItem->endCommand();
1312void QgsLayoutMapWidget::mGridDownButton_clicked()
1314 QListWidgetItem *item = mGridListWidget->currentItem();
1320 const int row = mGridListWidget->row( item );
1321 if ( mGridListWidget->count() <= row )
1325 mGridListWidget->takeItem( row );
1326 mGridListWidget->insertItem( row + 1, item );
1327 mGridListWidget->setCurrentItem( item );
1328 mMapItem->beginCommand( tr(
"Move Grid Down" ) );
1329 mMapItem->grids()->moveGridDown( item->data( Qt::UserRole ).toString() );
1330 mMapItem->endCommand();
1341 QListWidgetItem *item = mGridListWidget->currentItem();
1346 return mMapItem->grids()->grid( item->data( Qt::UserRole ).toString() );
1349void QgsLayoutMapWidget::mGridListWidget_currentItemChanged( QListWidgetItem *current, QListWidgetItem * )
1351 mGridPropertiesButton->setEnabled(
static_cast< bool >( current ) );
1354void QgsLayoutMapWidget::mGridListWidget_itemChanged( QListWidgetItem *item )
1367 mMapItem->beginCommand( tr(
"Rename Grid" ) );
1368 grid->
setName( item->text() );
1369 mMapItem->endCommand();
1372void QgsLayoutMapWidget::mGridPropertiesButton_clicked()
1389QListWidgetItem *QgsLayoutMapWidget::addGridListItem(
const QString &
id,
const QString &name )
1391 QListWidgetItem *item =
new QListWidgetItem( name,
nullptr );
1392 item->setData( Qt::UserRole,
id );
1393 item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
1394 mGridListWidget->insertItem( 0, item );
1398void QgsLayoutMapWidget::loadGridEntries()
1401 QSet<QString> selectedIds;
1402 const QList<QListWidgetItem *> itemSelection = mGridListWidget->selectedItems();
1403 QList<QListWidgetItem *>::const_iterator sIt = itemSelection.constBegin();
1404 for ( ; sIt != itemSelection.constEnd(); ++sIt )
1406 selectedIds.insert( ( *sIt )->data( Qt::UserRole ).toString() );
1409 mGridListWidget->clear();
1415 const QList< QgsLayoutItemMapGrid * > grids = mMapItem->grids()->asList();
1416 QList< QgsLayoutItemMapGrid * >::const_iterator gridIt = grids.constBegin();
1417 for ( ; gridIt != grids.constEnd(); ++gridIt )
1419 QListWidgetItem *item = addGridListItem( ( *gridIt )->id(), ( *gridIt )->name() );
1420 if ( selectedIds.contains( ( *gridIt )->id() ) )
1422 item->setSelected(
true );
1423 mGridListWidget->setCurrentItem( item );
1427 if ( mGridListWidget->currentItem() )
1429 mGridListWidget_currentItemChanged( mGridListWidget->currentItem(),
nullptr );
1433 mGridListWidget_currentItemChanged(
nullptr,
nullptr );
1437void QgsLayoutMapWidget::mAddOverviewPushButton_clicked()
1444 const QString itemName = tr(
"Overview %1" ).arg( mMapItem->overviews()->size() + 1 );
1446 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Add Map Overview" ) );
1447 mMapItem->overviews()->addOverview( overview );
1448 mMapItem->layout()->undoStack()->endCommand();
1449 mMapItem->invalidateCache();
1451 addOverviewListItem( overview->
id(), overview->
name() );
1453 mOverviewListWidget->setCurrentRow( 0 );
1456void QgsLayoutMapWidget::mRemoveOverviewPushButton_clicked()
1458 QListWidgetItem *item = mOverviewListWidget->currentItem();
1463 mMapItem->beginCommand( tr(
"Remove Map Overview" ) );
1464 mMapItem->overviews()->removeOverview( item->data( Qt::UserRole ).toString() );
1465 mMapItem->endCommand();
1466 QListWidgetItem *delItem = mOverviewListWidget->takeItem( mOverviewListWidget->row( item ) );
1468 mMapItem->invalidateCache();
1471void QgsLayoutMapWidget::mOverviewUpButton_clicked()
1473 QListWidgetItem *item = mOverviewListWidget->currentItem();
1479 const int row = mOverviewListWidget->row( item );
1484 mOverviewListWidget->takeItem( row );
1485 mOverviewListWidget->insertItem( row - 1, item );
1486 mOverviewListWidget->setCurrentItem( item );
1487 mMapItem->beginCommand( tr(
"Move Overview Up" ) );
1488 mMapItem->overviews()->moveOverviewUp( item->data( Qt::UserRole ).toString() );
1489 mMapItem->endCommand();
1490 mMapItem->invalidateCache();
1493void QgsLayoutMapWidget::mOverviewDownButton_clicked()
1495 QListWidgetItem *item = mOverviewListWidget->currentItem();
1501 const int row = mOverviewListWidget->row( item );
1502 if ( mOverviewListWidget->count() <= row )
1506 mOverviewListWidget->takeItem( row );
1507 mOverviewListWidget->insertItem( row + 1, item );
1508 mOverviewListWidget->setCurrentItem( item );
1509 mMapItem->beginCommand( tr(
"Move Overview Down" ) );
1510 mMapItem->overviews()->moveOverviewDown( item->data( Qt::UserRole ).toString() );
1511 mMapItem->endCommand();
1512 mMapItem->invalidateCache();
1522 QListWidgetItem *item = mOverviewListWidget->currentItem();
1528 return mMapItem->overviews()->overview( item->data( Qt::UserRole ).toString() );
1531void QgsLayoutMapWidget::mOverviewListWidget_currentItemChanged( QListWidgetItem *current, QListWidgetItem *previous )
1533 Q_UNUSED( previous )
1536 mOverviewCheckBox->setEnabled(
false );
1540 mOverviewCheckBox->setEnabled(
true );
1541 setOverviewItems( mMapItem->overviews()->overview( current->data( Qt::UserRole ).toString() ) );
1544void QgsLayoutMapWidget::mOverviewListWidget_itemChanged( QListWidgetItem *item )
1557 mMapItem->beginCommand( QStringLiteral(
"Rename Overview" ) );
1558 overview->
setName( item->text() );
1559 mMapItem->endCommand();
1560 if ( item->isSelected() )
1563 mOverviewCheckBox->setTitle( tr(
"Draw \"%1\" overview" ).arg( overview->
name() ) );
1567void QgsLayoutMapWidget::setOverviewItemsEnabled(
bool enabled )
1569 mOverviewFrameMapLabel->setEnabled( enabled );
1570 mOverviewFrameMapComboBox->setEnabled( enabled );
1571 mOverviewFrameStyleLabel->setEnabled( enabled );
1572 mOverviewFrameStyleButton->setEnabled( enabled );
1573 mOverviewBlendModeLabel->setEnabled( enabled );
1574 mOverviewBlendModeComboBox->setEnabled( enabled );
1575 mOverviewInvertCheckbox->setEnabled( enabled );
1576 mOverviewCenterCheckbox->setEnabled( enabled );
1577 mOverviewPositionComboBox->setEnabled( enabled );
1583void QgsLayoutMapWidget::blockOverviewItemsSignals(
const bool block )
1585 mOverviewFrameMapComboBox->blockSignals( block );
1586 mOverviewFrameStyleButton->blockSignals( block );
1587 mOverviewBlendModeComboBox->blockSignals( block );
1588 mOverviewInvertCheckbox->blockSignals( block );
1589 mOverviewCenterCheckbox->blockSignals( block );
1590 mOverviewPositionComboBox->blockSignals( block );
1591 mOverviewStackingLayerComboBox->blockSignals( block );
1601 blockOverviewItemsSignals(
true );
1603 mOverviewCheckBox->setTitle( tr(
"Draw \"%1\" overview" ).arg( overview->
name() ) );
1604 mOverviewCheckBox->setChecked( overview->
enabled() );
1607 mOverviewFrameMapComboBox->setItem( overview->
linkedMap() );
1610 mOverviewBlendModeComboBox->setBlendMode( overview->
blendMode() );
1612 mOverviewInvertCheckbox->setChecked( overview->
inverted() );
1614 mOverviewCenterCheckbox->setChecked( overview->
centered() );
1616 mOverviewPositionComboBox->setCurrentIndex( mOverviewPositionComboBox->findData( overview->
stackingPosition() ) );
1617 mOverviewStackingLayerComboBox->setLayer( overview->
stackingLayer() );
1623 blockOverviewItemsSignals(
false );
1626void QgsLayoutMapWidget::storeCurrentLayerSet()
1633 mMapItem->setLayers( layers );
1635 if ( mMapItem->keepLayerStyles() )
1638 mMapItem->storeCurrentLayerStyles();
1642QList<QgsMapLayer *> QgsLayoutMapWidget::orderedPresetVisibleLayers(
const QString &name )
const
1647 QList<QgsMapLayer *> lst;
1651 if ( visibleIds.contains( layer->
id() ) )
1659QListWidgetItem *QgsLayoutMapWidget::addOverviewListItem(
const QString &
id,
const QString &name )
1661 QListWidgetItem *item =
new QListWidgetItem( name,
nullptr );
1662 item->setData( Qt::UserRole,
id );
1663 item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
1664 mOverviewListWidget->insertItem( 0, item );
1668void QgsLayoutMapWidget::loadOverviewEntries()
1671 QSet<QString> selectedIds;
1672 const QList<QListWidgetItem *> itemSelection = mOverviewListWidget->selectedItems();
1673 QList<QListWidgetItem *>::const_iterator sIt = itemSelection.constBegin();
1674 for ( ; sIt != itemSelection.constEnd(); ++sIt )
1676 selectedIds.insert( ( *sIt )->data( Qt::UserRole ).toString() );
1679 mOverviewListWidget->clear();
1685 mOverviewFrameMapComboBox->setExceptedItemList( QList< QgsLayoutItem * >() << mMapItem );
1688 const QList< QgsLayoutItemMapOverview * > overviews = mMapItem->overviews()->asList();
1689 QList< QgsLayoutItemMapOverview * >::const_iterator overviewIt = overviews.constBegin();
1690 for ( ; overviewIt != overviews.constEnd(); ++overviewIt )
1692 QListWidgetItem *item = addOverviewListItem( ( *overviewIt )->id(), ( *overviewIt )->name() );
1693 if ( selectedIds.contains( ( *overviewIt )->id() ) )
1695 item->setSelected(
true );
1696 mOverviewListWidget->setCurrentItem( item );
1700 if ( mOverviewListWidget->currentItem() )
1702 mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(),
nullptr );
1706 mOverviewListWidget_currentItemChanged(
nullptr,
nullptr );
1710void QgsLayoutMapWidget::mOverviewCheckBox_toggled(
bool state )
1718 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Overview Display Toggled" ) );
1720 mMapItem->invalidateCache();
1721 mMapItem->layout()->undoStack()->endCommand();
1724void QgsLayoutMapWidget::overviewMapChanged(
QgsLayoutItem *item )
1736 mMapItem->beginCommand( tr(
"Change Overview Map" ) );
1738 mMapItem->invalidateCache();
1739 mMapItem->endCommand();
1742void QgsLayoutMapWidget::mOverviewBlendModeComboBox_currentIndexChanged(
int index )
1751 mMapItem->beginCommand( tr(
"Change Overview Blend Mode" ) );
1752 overview->
setBlendMode( mOverviewBlendModeComboBox->blendMode() );
1753 mMapItem->invalidateCache();
1754 mMapItem->endCommand();
1757void QgsLayoutMapWidget::mOverviewInvertCheckbox_toggled(
bool state )
1765 mMapItem->beginCommand( tr(
"Toggle Overview Inverted" ) );
1767 mMapItem->invalidateCache();
1768 mMapItem->endCommand();
1771void QgsLayoutMapWidget::mOverviewCenterCheckbox_toggled(
bool state )
1779 mMapItem->beginCommand( tr(
"Toggle Overview Centered" ) );
1781 mMapItem->invalidateCache();
1782 mMapItem->endCommand();
1785void QgsLayoutMapWidget::overviewStackingChanged(
int )
1793 mMapItem->beginCommand( tr(
"Change Overview Position" ) );
1795 mMapItem->invalidateCache();
1796 mMapItem->endCommand();
1803 mOverviewStackingLayerComboBox->setEnabled(
false );
1808 mOverviewStackingLayerComboBox->setEnabled(
true );
1813void QgsLayoutMapWidget::overviewStackingLayerChanged(
QgsMapLayer *layer )
1821 mMapItem->beginCommand( tr(
"Change Overview Position" ) );
1823 mMapItem->invalidateCache();
1824 mMapItem->endCommand();
1838 mLabelBoundarySpinBox->setClearValue( 0 );
1839 mLabelBoundarySpinBox->setShowClearButton(
true );
1841 mLabelBoundaryUnitsCombo->linkToWidget( mLabelBoundarySpinBox );
1842 mLabelBoundaryUnitsCombo->setConverter( &mMapItem->layout()->renderContext().measurementConverter() );
1845 connect( mLabelBoundarySpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapLabelingWidget::labelMarginChanged );
1846 connect( mShowPartialLabelsCheckBox, &QCheckBox::toggled,
this, &QgsLayoutMapLabelingWidget::showPartialsToggled );
1847 connect( mShowUnplacedCheckBox, &QCheckBox::toggled,
this, &QgsLayoutMapLabelingWidget::showUnplacedToggled );
1864 mMapItem = qobject_cast< QgsLayoutItemMap * >( item );
1871 updateGuiElements();
1876void QgsLayoutMapLabelingWidget::updateGuiElements()
1878 whileBlocking( mLabelBoundarySpinBox )->setValue( mMapItem->labelMargin().length() );
1879 whileBlocking( mLabelBoundaryUnitsCombo )->setUnit( mMapItem->labelMargin().units() );
1883 if ( mBlockingItemsListView->model() )
1885 QAbstractItemModel *oldModel = mBlockingItemsListView->model();
1886 mBlockingItemsListView->setModel(
nullptr );
1887 oldModel->deleteLater();
1891 mBlockingItemsListView->setModel( model );
1896void QgsLayoutMapLabelingWidget::labelMarginChanged(
double val )
1903 mMapItem->layout()->undoStack()->endCommand();
1904 mMapItem->invalidateCache();
1907void QgsLayoutMapLabelingWidget::labelMarginUnitsChanged()
1913 mMapItem->setLabelMargin(
QgsLayoutMeasurement( mLabelBoundarySpinBox->value(), mLabelBoundaryUnitsCombo->unit() ) );
1914 mMapItem->layout()->undoStack()->endCommand();
1915 mMapItem->invalidateCache();
1918void QgsLayoutMapLabelingWidget::showPartialsToggled(
bool checked )
1923 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Visibility" ) );
1929 mMapItem->setMapFlags( flags );
1930 mMapItem->layout()->undoStack()->endCommand();
1931 mMapItem->invalidateCache();
1934void QgsLayoutMapLabelingWidget::showUnplacedToggled(
bool checked )
1939 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Visibility" ) );
1945 mMapItem->setMapFlags( flags );
1946 mMapItem->layout()->undoStack()->endCommand();
1947 mMapItem->invalidateCache();
1951 : QSortFilterProxyModel( parent )
1952 , mLayoutModel( layoutModel )
1955 setSourceModel( layoutModel );
1968 if ( i.column() != 0 )
1981 case Qt::CheckStateRole:
1982 switch ( i.column() )
1985 return mMapItem ? ( mMapItem->isLabelBlockingItem( item ) ? Qt::Checked : Qt::Unchecked ) : Qt::Unchecked;
1991 return mLayoutModel->
data( sourceIndex, role );
1999 if ( !index.isValid() )
2003 if ( !item || !mMapItem )
2008 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Blocking Items" ) );
2010 if ( value.toBool() )
2012 mMapItem->addLabelBlockingItem( item );
2016 mMapItem->removeLabelBlockingItem( item );
2018 emit dataChanged( index, index, QVector<int>() << role );
2020 mMapItem->layout()->undoStack()->endCommand();
2021 mMapItem->invalidateCache();
2028 Qt::ItemFlags
flags = QSortFilterProxyModel::flags( index );
2030 if ( ! index.isValid() )
2035 switch ( index.column() )
2038 return flags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
2040 return flags | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
2047 if ( !item || item == mMapItem )
2070 mLayersTreeView->setModel( mLayerModel );
2076 for (
int i = 0; i < mAtlasClippingTypeComboBox->count(); ++i )
2078 mItemClippingTypeComboBox->addItem( mAtlasClippingTypeComboBox->itemText( i ), mAtlasClippingTypeComboBox->itemData( i ) );
2081 mClipItemComboBox->setCurrentLayout( map->
layout() );
2084 connect( mRadioClipSelectedLayers, &QRadioButton::toggled,
this, &QgsLayoutMapClippingWidget::toggleLayersSelectionGui );
2085 mLayersTreeView->setEnabled(
false );
2086 mSelectAllButton->setEnabled(
false );
2087 mDeselectAllButton->setEnabled(
false );
2088 mInvertSelectionButton->setEnabled(
false );
2089 mRadioClipAllLayers->setChecked(
true );
2091 connect( mClipToAtlasCheckBox, &QGroupBox::toggled,
this, [ = ](
bool active )
2093 if ( !mBlockUpdates )
2095 mMapItem->beginCommand( tr(
"Toggle Atlas Clipping" ) );
2096 mMapItem->atlasClippingSettings()->setEnabled( active );
2097 mMapItem->endCommand();
2100 connect( mForceLabelsInsideCheckBox, &QCheckBox::toggled,
this, [ = ](
bool active )
2102 if ( !mBlockUpdates )
2104 mMapItem->beginCommand( tr(
"Change Atlas Clipping Label Behavior" ) );
2105 mMapItem->atlasClippingSettings()->setForceLabelsInsideFeature( active );
2106 mMapItem->endCommand();
2109 connect( mAtlasClippingTypeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ]
2111 if ( !mBlockUpdates )
2113 mMapItem->beginCommand( tr(
"Change Atlas Clipping Behavior" ) );
2115 mMapItem->endCommand();
2119 connect( mRadioClipSelectedLayers, &QCheckBox::toggled,
this, [ = ](
bool active )
2121 if ( active && !mBlockUpdates )
2123 mBlockUpdates =
true;
2124 mMapItem->beginCommand( tr(
"Change Atlas Clipping Layers" ) );
2125 mMapItem->atlasClippingSettings()->setRestrictToLayers(
true );
2126 mMapItem->endCommand();
2127 mBlockUpdates =
false;
2131 connect( mSelectAllButton, &QPushButton::clicked,
this, &QgsLayoutMapClippingWidget::selectAll );
2132 connect( mDeselectAllButton, &QPushButton::clicked,
this, &QgsLayoutMapClippingWidget::deselectAll );
2133 connect( mInvertSelectionButton, &QPushButton::clicked,
this, &QgsLayoutMapClippingWidget::invertSelection );
2135 connect( mRadioClipAllLayers, &QCheckBox::toggled,
this, [ = ](
bool active )
2137 if ( active && !mBlockUpdates )
2139 mBlockUpdates =
true;
2140 mMapItem->beginCommand( tr(
"Change Atlas Clipping Layers" ) );
2141 mMapItem->atlasClippingSettings()->setRestrictToLayers(
false );
2142 mMapItem->endCommand();
2143 mBlockUpdates =
false;
2146 connect( mLayerModel, &QgsMapLayerModel::dataChanged,
this, [ = ](
const QModelIndex &,
const QModelIndex &,
const QVector<int> &roles = QVector<int>() )
2148 if ( !roles.contains( Qt::CheckStateRole ) )
2151 if ( !mBlockUpdates )
2153 mBlockUpdates =
true;
2154 mMapItem->beginCommand( tr(
"Change Atlas Clipping Layers" ) );
2155 mMapItem->atlasClippingSettings()->setLayersToClip( mLayerModel->
layersChecked() );
2156 mMapItem->endCommand();
2157 mBlockUpdates =
false;
2163 connect( mClipToItemCheckBox, &QGroupBox::toggled,
this, [ = ](
bool active )
2165 if ( !mBlockUpdates )
2167 mMapItem->beginCommand( tr(
"Toggle Map Clipping" ) );
2168 mMapItem->itemClippingSettings()->setEnabled( active );
2169 mMapItem->endCommand();
2172 connect( mItemClippingTypeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ]
2174 if ( !mBlockUpdates )
2176 mMapItem->beginCommand( tr(
"Change Map Clipping Behavior" ) );
2178 mMapItem->endCommand();
2181 connect( mForceLabelsInsideItemCheckBox, &QCheckBox::toggled,
this, [ = ](
bool active )
2183 if ( !mBlockUpdates )
2185 mMapItem->beginCommand( tr(
"Change Map Clipping Label Behavior" ) );
2186 mMapItem->itemClippingSettings()->setForceLabelsInsideClipPath( active );
2187 mMapItem->endCommand();
2192 if ( !mBlockUpdates )
2194 mMapItem->beginCommand( tr(
"Change Map Clipping Item" ) );
2195 mMapItem->itemClippingSettings()->setSourceItem( item );
2196 mMapItem->endCommand();
2203 this, &QgsLayoutMapClippingWidget::atlasLayerChanged );
2207 atlasToggled( atlas->enabled() );
2213 mClipToAtlasCheckBox->setTitle( tr(
"Clip to %1 feature" ).arg(
string ) );
2214 mClipToAtlasLabel->setText( tr(
"<b>When enabled, map layers will be automatically clipped to the boundary of the current %1 feature.</b>" ).arg(
string ) );
2215 mForceLabelsInsideCheckBox->setText( tr(
"Force labels inside %1 feature" ).arg(
string ) );
2228 mMapItem = qobject_cast< QgsLayoutItemMap * >( item );
2235 updateGuiElements();
2240void QgsLayoutMapClippingWidget::updateGuiElements()
2242 if ( mBlockUpdates )
2245 mBlockUpdates =
true;
2246 mClipToAtlasCheckBox->setChecked( mMapItem->atlasClippingSettings()->enabled() );
2247 mAtlasClippingTypeComboBox->setCurrentIndex( mAtlasClippingTypeComboBox->findData(
static_cast< int >( mMapItem->atlasClippingSettings()->featureClippingType() ) ) );
2248 mForceLabelsInsideCheckBox->setChecked( mMapItem->atlasClippingSettings()->forceLabelsInsideFeature() );
2250 mRadioClipAllLayers->setChecked( !mMapItem->atlasClippingSettings()->restrictToLayers() );
2251 mRadioClipSelectedLayers->setChecked( mMapItem->atlasClippingSettings()->restrictToLayers() );
2252 mLayerModel->
setLayersChecked( mMapItem->atlasClippingSettings()->layersToClip() );
2254 mClipToItemCheckBox->setChecked( mMapItem->itemClippingSettings()->enabled() );
2255 mItemClippingTypeComboBox->setCurrentIndex( mItemClippingTypeComboBox->findData(
static_cast< int >( mMapItem->itemClippingSettings()->featureClippingType() ) ) );
2256 mForceLabelsInsideItemCheckBox->setChecked( mMapItem->itemClippingSettings()->forceLabelsInsideClipPath() );
2257 mClipItemComboBox->setItem( mMapItem->itemClippingSettings()->sourceItem() );
2259 mBlockUpdates =
false;
2262void QgsLayoutMapClippingWidget::atlasLayerChanged(
QgsVectorLayer *layer )
2267 mClipToAtlasCheckBox->setChecked(
false );
2268 mClipToAtlasCheckBox->setEnabled(
false );
2273 mClipToAtlasCheckBox->setEnabled(
true );
2277void QgsLayoutMapClippingWidget::atlasToggled(
bool atlasEnabled )
2279 if ( atlasEnabled &&
2280 mMapItem && mMapItem->layout() && mMapItem->layout()->reportContext().layer()
2283 mClipToAtlasCheckBox->setEnabled(
true );
2287 mClipToAtlasCheckBox->setEnabled(
false );
2288 mClipToAtlasCheckBox->setChecked(
false );
2292void QgsLayoutMapClippingWidget::invertSelection()
2294 for (
int i = 0; i < mLayerModel->
rowCount( QModelIndex() ); i++ )
2296 QModelIndex index = mLayerModel->
index( i, 0 );
2297 Qt::CheckState currentState = Qt::CheckState( mLayerModel->
data( index, Qt::CheckStateRole ).toInt() );
2298 Qt::CheckState newState = ( currentState == Qt::Checked ) ? Qt::Unchecked : Qt::Checked;
2299 mLayerModel->
setData( index, newState, Qt::CheckStateRole );
2303void QgsLayoutMapClippingWidget::selectAll()
2305 for (
int i = 0; i < mLayerModel->
rowCount( QModelIndex() ); i++ )
2307 QModelIndex index = mLayerModel->
index( i, 0 );
2308 mLayerModel->
setData( index, Qt::Checked, Qt::CheckStateRole );
2312void QgsLayoutMapClippingWidget::deselectAll()
2314 for (
int i = 0; i < mLayerModel->
rowCount( QModelIndex() ); i++ )
2316 QModelIndex index = mLayerModel->
index( i, 0 );
2317 mLayerModel->
setData( index, Qt::Unchecked, Qt::CheckStateRole );
2321void QgsLayoutMapClippingWidget::toggleLayersSelectionGui(
bool toggled )
2323 mLayersTreeView->setEnabled( toggled );
2324 mSelectAllButton->setEnabled( toggled );
2325 mDeselectAllButton->setEnabled( toggled );
2326 mInvertSelectionButton->setEnabled( toggled );
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsBookmarkManager * bookmarkManager()
Returns the application's bookmark manager, used for storing installation-wide bookmarks.
@ Extent
Bookmark extent as a QgsReferencedRectangle.
A QSortFilterProxyModel subclass for sorting the entries in a QgsBookmarkManagerModel.
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
Custom exception class for Coordinate Reference System related exceptions.
QgsRange which stores a range of double values.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
@ MinimumValue
Reset value to minimum()
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
QList< QgsMapLayer * > layerOrder() const
The order in which layers will be rendered on the canvas.
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
void toggled(bool)
Emitted when atlas is enabled or disabled.
A common interface for layout designer dialogs and widgets.
virtual void activateTool(StandardTool tool)=0
Activates a standard layout designer tool.
@ ToolMoveItemContent
Move item content tool.
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
void copyProperties(const QgsLayoutItemMapGrid *other)
Copies properties from specified map grid.
QString id() const
Returns the unique id for the map item.
StackingPosition
Item stacking position, specifies where the in the map's stack the item should be rendered.
@ StackBelowMapLabels
Render above all map layers, but below map labels.
@ StackAboveMapLabels
Render above all map layers and labels.
@ StackBelowMapLayer
Render below a specific map layer (see stackingLayer())
@ StackAboveMapLayer
Render above a specific map layer (see stackingLayer())
@ StackBelowMap
Render below all map layers.
void setStackingLayer(QgsMapLayer *layer)
Sets the item's stacking layer, which specifies where the in the map's stack the item should be rende...
virtual void setEnabled(bool enabled)
Controls whether the item will be drawn.
void setStackingPosition(StackingPosition position)
Sets the item's stacking position, which specifies where the in the map's stack the item should be re...
StackingPosition stackingPosition() const
Returns the item's stacking position, which specifies where the in the map's stack the item should be...
QString name() const
Returns the friendly display name for the item.
void setName(const QString &name)
Sets the friendly display name for the item.
bool enabled() const
Returns whether the item will be drawn.
QgsMapLayer * stackingLayer() const
Returns the item's stacking layer, which specifies where the in the map's stack the item should be re...
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
QgsFillSymbol * frameSymbol()
Returns the fill symbol used for drawing the overview extent.
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the overview.
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to show the overview extent of.
void setFrameSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used for drawing the overview extent.
bool inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the exte...
void setInverted(bool inverted)
Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent ...
void setCentered(bool centered)
Sets whether the extent of the map is forced to center on the overview.
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.
Layout graphical items for displaying a map.
void extentChanged()
Emitted when the map's extent changes.
@ Predefined
A scale is chosen from the predefined scales.
@ Auto
The extent is adjusted so that each feature is fully visible.
@ Fixed
The current scale of the map is used for each feature of the atlas.
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
QFlags< MapItemFlag > MapItemFlags
@ ShowPartialLabels
Whether to draw labels which are partially outside of the map view.
@ ShowUnplacedLabels
Whether to render unplaced labels in the map view.
Base class for graphical items within a QgsLayout.
@ UndoOverviewStyle
Map overview style.
@ UndoMapRotation
Map rotation changed.
@ UndoAtlasMargin
Map atlas margin changed.
@ UndoMapLabelMargin
Margin for labels from edge of map.
int type() const override
Returns a unique graphics item type identifier.
@ FlagProvidesClipPath
Item can act as a clipping path provider (see clipPath())
Model for label blocking items.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
QgsLayoutMapItemBlocksLabelsModel(QgsLayoutItemMap *map, QgsLayoutModel *layoutModel, QObject *parent=nullptr)
constructor
Qt::ItemFlags flags(const QModelIndex &index) const override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QVariant data(const QModelIndex &index, int role) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
A model for items attached to a layout.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
QgsLayoutItem * itemFromIndex(const QModelIndex &index) const
Returns the QgsLayoutItem corresponding to a QModelIndex index, if possible.
const QgsLayout * layout() const
Returns the layout the object is attached to.
void changed()
Emitted when the object's properties change.
@ MapYMin
Map extent y minimum.
@ MapZRangeUpper
Map frame Z-range lower value (since QGIS 3.38)
@ StartDateTime
Temporal range's start DateTime.
@ MapLayers
Map layer set.
@ MapZRangeLower
Map frame Z-range lower value (since QGIS 3.38)
@ MapRotation
Map rotation.
@ MapXMax
Map extent x maximum.
@ MapStylePreset
Layer and style map theme.
@ MapYMax
Map extent y maximum.
@ MapAtlasMargin
Map atlas margin.
@ EndDateTime
Temporal range's end DateTime.
@ MapXMin
Map extent x minimum.
@ MapLabelMargin
Map label margin.
@ OriginalValue
Return the original, user set value.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
void unitChanged(Qgis::LayoutUnit unit)
Emitted when the unit is changed.
QgsLayoutReportContext & reportContext()
Returns a reference to the layout's report context, which stores information relating to the current ...
Map canvas is a class for displaying all GIS data types on a canvas.
void zoomScale(double scale, bool ignoreScaleLock=false)
Zooms the canvas to a specific scale.
bool setReferencedExtent(const QgsReferencedRectangle &extent)
Sets the canvas to the specified extent.
double scale() const
Returns the last reported scale of the canvas.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
void refresh()
Repaints the canvas map.
FeatureClippingType
Feature clipping behavior, which controls how features from vector layers will be clipped.
@ NoClipping
Only render features which intersect the clipping region, but do not clip these features to the regio...
@ ClipPainterOnly
Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisibl...
@ ClipToIntersection
Clip the geometry of these features to the region prior to rendering (i.e. feature boundaries will fo...
void layerChanged(QgsMapLayer *layer)
Emitted whenever the currently selected layer changes.
The QgsMapLayerModel class is a model to display layers in widgets.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QList< QgsMapLayer * > layersChecked(Qt::CheckState checkState=Qt::Checked)
layersChecked returns the list of layers which are checked (or unchecked)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
void setItemsCheckable(bool checkable)
setItemsCheckable defines if layers should be selectable in the widget
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
void setLayersChecked(const QList< QgsMapLayer * > &layers)
Sets which layers are checked in the model.
Base class for all map layer types.
QList< QgsMapLayer * > layers(bool expandGroupLayers=false) const
Returns the list of layers which will be rendered in the map.
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
void mapThemesChanged()
Emitted when map themes within the collection are changed.
QStringList mapThemeVisibleLayerIds(const QString &name) const
Returns the list of layer IDs that are visible for the specified map theme.
Interface for master layout type objects, such as print layouts and reports.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsMapThemeCollection * mapThemeCollection
QgsLayerTree * layerTreeRoot() const
Returns pointer to the root (invisible) node of the project's layer tree.
A rectangle specified with double values.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
bool isEmpty() const
Returns true if the rectangle has no area.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
A QgsRectangle with associated coordinate reference system.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
static const QgsSettingsEntryStringList * settingsMapScales
This class is a composition of two QSettings instances:
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
const QgsCoordinateReferenceSystem & crs