39 #include <QMessageBox>
44 , mMapCanvas( mapCanvas )
49 connect( mScaleLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mScaleLineEdit_editingFinished );
50 connect( mActionSetToCanvasExtent, &QAction::triggered,
this, &QgsLayoutMapWidget::setToMapCanvasExtent );
51 connect( mActionViewExtentInCanvas, &QAction::triggered,
this, &QgsLayoutMapWidget::viewExtentInCanvas );
52 connect( mActionSetToCanvasScale, &QAction::triggered,
this, &QgsLayoutMapWidget::setToMapCanvasScale );
53 connect( mActionViewScaleInCanvas, &QAction::triggered,
this, &QgsLayoutMapWidget::viewScaleInCanvas );
54 connect( mActionUpdatePreview, &QAction::triggered,
this, &QgsLayoutMapWidget::updatePreview );
55 connect( mFollowVisibilityPresetCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mFollowVisibilityPresetCheckBox_stateChanged );
56 connect( mKeepLayerListCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mKeepLayerListCheckBox_stateChanged );
57 connect( mKeepLayerStylesCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mKeepLayerStylesCheckBox_stateChanged );
58 connect( mDrawCanvasItemsCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutMapWidget::mDrawCanvasItemsCheckBox_stateChanged );
59 connect( mOverviewBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::mOverviewBlendModeComboBox_currentIndexChanged );
60 connect( mOverviewInvertCheckbox, &QCheckBox::toggled,
this, &QgsLayoutMapWidget::mOverviewInvertCheckbox_toggled );
61 connect( mOverviewCenterCheckbox, &QCheckBox::toggled,
this, &QgsLayoutMapWidget::mOverviewCenterCheckbox_toggled );
62 connect( mOverviewPositionComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::overviewStackingChanged );
64 connect( mXMinLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mXMinLineEdit_editingFinished );
65 connect( mXMaxLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mXMaxLineEdit_editingFinished );
66 connect( mYMinLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mYMinLineEdit_editingFinished );
67 connect( mYMaxLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutMapWidget::mYMaxLineEdit_editingFinished );
68 connect( mAtlasMarginRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasMarginRadio_toggled );
69 connect( mAtlasCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mAtlasCheckBox_toggled );
70 connect( mAtlasMarginSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::mAtlasMarginSpinBox_valueChanged );
71 connect( mAtlasFixedScaleRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasFixedScaleRadio_toggled );
72 connect( mAtlasPredefinedScaleRadio, &QRadioButton::toggled,
this, &QgsLayoutMapWidget::mAtlasPredefinedScaleRadio_toggled );
73 connect( mAddGridPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mAddGridPushButton_clicked );
74 connect( mRemoveGridPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mRemoveGridPushButton_clicked );
75 connect( mGridUpButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridUpButton_clicked );
76 connect( mGridDownButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridDownButton_clicked );
77 connect( mGridListWidget, &QListWidget::currentItemChanged,
this, &QgsLayoutMapWidget::mGridListWidget_currentItemChanged );
78 connect( mGridListWidget, &QListWidget::itemChanged,
this, &QgsLayoutMapWidget::mGridListWidget_itemChanged );
79 connect( mGridPropertiesButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mGridPropertiesButton_clicked );
80 connect( mAddOverviewPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mAddOverviewPushButton_clicked );
81 connect( mRemoveOverviewPushButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mRemoveOverviewPushButton_clicked );
82 connect( mOverviewUpButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mOverviewUpButton_clicked );
83 connect( mOverviewDownButton, &QPushButton::clicked,
this, &QgsLayoutMapWidget::mOverviewDownButton_clicked );
84 connect( mOverviewCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mOverviewCheckBox_toggled );
85 connect( mOverviewListWidget, &QListWidget::currentItemChanged,
this, &QgsLayoutMapWidget::mOverviewListWidget_currentItemChanged );
86 connect( mOverviewListWidget, &QListWidget::itemChanged,
this, &QgsLayoutMapWidget::mOverviewListWidget_itemChanged );
87 connect( mActionLabelSettings, &QAction::triggered,
this, &QgsLayoutMapWidget::showLabelSettings );
88 connect( mTemporalCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutMapWidget::mTemporalCheckBox_toggled );
89 connect( mStartDateTime, &QDateTimeEdit::dateTimeChanged,
this, &QgsLayoutMapWidget::updateTemporalExtent );
90 connect( mEndDateTime, &QDateTimeEdit::dateTimeChanged,
this, &QgsLayoutMapWidget::updateTemporalExtent );
92 mStartDateTime->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
93 mEndDateTime->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
95 connect( mActionMoveContent, &QAction::triggered,
this, &QgsLayoutMapWidget::switchToMoveContentTool );
97 mMapRotationSpinBox->setClearValue( 0 );
101 mBookmarkMenu =
new QMenu(
this );
102 QToolButton *btnBookmarks =
new QToolButton(
this );
103 btnBookmarks->setAutoRaise(
true );
104 btnBookmarks->setToolTip( tr(
"Bookmarks" ) );
106 btnBookmarks->setPopupMode( QToolButton::InstantPopup );
107 btnBookmarks->setMenu( mBookmarkMenu );
109 mDockToolbar->insertWidget( mActionMoveContent, btnBookmarks );
110 connect( mBookmarkMenu, &QMenu::aboutToShow,
this, &QgsLayoutMapWidget::aboutToShowBookmarkMenu );
114 mainLayout->addWidget( mItemPropertiesWidget );
116 mScaleLineEdit->setValidator(
new QDoubleValidator( mScaleLineEdit ) );
118 mXMinLineEdit->setValidator(
new QDoubleValidator( mXMinLineEdit ) );
119 mXMaxLineEdit->setValidator(
new QDoubleValidator( mXMaxLineEdit ) );
120 mYMinLineEdit->setValidator(
new QDoubleValidator( mYMinLineEdit ) );
121 mYMaxLineEdit->setValidator(
new QDoubleValidator( mYMaxLineEdit ) );
129 blockAllSignals(
true );
132 mCrsSelector->setNotSetText( tr(
"Use Project CRS" ) );
137 mFollowVisibilityPresetCombo->setModel(
new QStringListModel( mFollowVisibilityPresetCombo ) );
138 connect( mFollowVisibilityPresetCombo,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutMapWidget::followVisibilityPresetSelected );
140 this, &QgsLayoutMapWidget::onMapThemesChanged );
141 onMapThemesChanged();
144 QMenu *menuKeepLayers =
new QMenu(
this );
145 mLayerListFromPresetButton->setMenu( menuKeepLayers );
147 mLayerListFromPresetButton->setToolTip( tr(
"Set layer list from a map theme" ) );
148 connect( menuKeepLayers, &QMenu::aboutToShow,
this, &QgsLayoutMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu );
153 this, &QgsLayoutMapWidget::atlasLayerChanged );
157 compositionAtlasToggled( atlas->enabled() );
160 mOverviewFrameMapComboBox->setCurrentLayout( item->
layout() );
162 mOverviewFrameStyleButton->registerExpressionContextGenerator( item );
168 mOverviewFrameStyleButton->registerExpressionContextGenerator( item );
191 loadOverviewEntries();
193 connect( mMapRotationSpinBox,
static_cast < void (
QgsDoubleSpinBox::* )(
double )
> ( &QgsDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapWidget::rotationChanged );
197 blockAllSignals(
false );
202 if ( mItemPropertiesWidget )
208 mAtlasCheckBox->setTitle( tr(
"Controlled by %1" ).arg(
string == tr(
"atlas" ) ? tr(
"Atlas" ) : tr(
"Report" ) ) );
209 mAtlasPredefinedScaleRadio->setToolTip( tr(
"Use one of the predefined scales of the project where the %1 feature best fits." ).arg(
string ) );
230 mMapItem = qobject_cast< QgsLayoutItemMap * >( item );
231 mItemPropertiesWidget->
setItem( mMapItem );
233 mLabelWidget->setItem( mMapItem );
240 mOverviewFrameStyleButton->registerExpressionContextGenerator( mMapItem );
264 void QgsLayoutMapWidget::compositionAtlasToggled(
bool atlasEnabled )
267 mMapItem && mMapItem->layout() && mMapItem->layout()->reportContext().layer()
270 mAtlasCheckBox->setEnabled(
true );
274 mAtlasCheckBox->setEnabled(
false );
275 mAtlasCheckBox->setChecked(
false );
279 void QgsLayoutMapWidget::aboutToShowKeepLayersVisibilityPresetsMenu()
284 QMenu *menu = qobject_cast<QMenu *>( sender() );
290 for (
const QString &presetName : constMapThemes )
292 menu->addAction( presetName,
this, &QgsLayoutMapWidget::keepLayersVisibilityPresetSelected );
295 if ( menu->actions().isEmpty() )
296 menu->addAction( tr(
"No presets defined" ) )->setEnabled(
false );
299 void QgsLayoutMapWidget::followVisibilityPresetSelected(
int currentIndex )
304 if ( currentIndex == -1 )
308 if ( currentIndex != 0 )
310 presetName = mFollowVisibilityPresetCombo->currentText();
313 if ( presetName == mMapItem->followVisibilityPresetName() )
316 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
317 mFollowVisibilityPresetCheckBox->setChecked(
true );
318 mMapItem->setFollowVisibilityPresetName( presetName );
319 mMapItem->layout()->undoStack()->endCommand();
321 mMapItem->invalidateCache();
324 void QgsLayoutMapWidget::keepLayersVisibilityPresetSelected()
326 QAction *action = qobject_cast<QAction *>( sender() );
330 QString presetName = action->text();
331 QList<QgsMapLayer *> lst = orderedPresetVisibleLayers( presetName );
334 mKeepLayerListCheckBox->setChecked(
true );
335 mMapItem->setLayers( lst );
337 mKeepLayerStylesCheckBox->setChecked(
true );
339 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
340 mMapItem->setLayerStyleOverrides(
QgsProject::instance()->mapThemeCollection()->mapThemeStyleOverrides( presetName ) );
341 mMapItem->layout()->undoStack()->endCommand();
343 mMapItem->invalidateCache();
347 void QgsLayoutMapWidget::onMapThemesChanged()
349 if ( QStringListModel *model = qobject_cast<QStringListModel *>( mFollowVisibilityPresetCombo->model() ) )
352 lst.append( tr(
"(none)" ) );
354 model->setStringList( lst );
357 int presetModelIndex = mFollowVisibilityPresetCombo->findText( mMapItem->followVisibilityPresetName() );
358 mFollowVisibilityPresetCombo->blockSignals(
true );
359 mFollowVisibilityPresetCombo->setCurrentIndex( presetModelIndex != -1 ? presetModelIndex : 0 );
360 mFollowVisibilityPresetCombo->blockSignals(
false );
371 if ( mMapItem->presetCrs() ==
crs )
377 bool updateExtent =
false;
383 newExtent = xForm.transformBoundingBox( prevExtent );
391 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map CRS" ) );
392 mMapItem->setCrs(
crs );
394 mMapItem->zoomToExtent( newExtent );
395 mMapItem->layout()->undoStack()->endCommand();
396 mMapItem->invalidateCache();
399 void QgsLayoutMapWidget::overviewSymbolChanged()
407 mMapItem->endCommand();
408 mMapItem->invalidateCache();
411 void QgsLayoutMapWidget::showLabelSettings()
417 void QgsLayoutMapWidget::switchToMoveContentTool()
423 void QgsLayoutMapWidget::aboutToShowBookmarkMenu()
425 mBookmarkMenu->clear();
429 if ( !mBookmarkModel )
432 QMap< QString, QMenu * > groupMenus;
433 for (
int i = 0; i < mBookmarkModel->rowCount(); ++i )
436 QMenu *destMenu = mBookmarkMenu;
437 if ( !group.isEmpty() )
439 destMenu = groupMenus.value( group );
442 destMenu =
new QMenu( group, mBookmarkMenu );
443 groupMenus[ group ] = destMenu;
448 connect( action, &QAction::triggered,
this, [ = ]
458 if ( extent.
crs() != mMapItem->crs() )
462 QgsCoordinateTransform xForm( extent.crs(), mMapItem->crs(), QgsProject::instance() );
463 newExtent = xForm.transformBoundingBox( newExtent );
472 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
473 mMapItem->zoomToExtent( newExtent );
474 mMapItem->layout()->undoStack()->endCommand();
476 destMenu->addAction( action );
479 QStringList groupKeys = groupMenus.keys();
480 groupKeys.sort( Qt::CaseInsensitive );
481 for (
int i = 0; i < groupKeys.count(); ++i )
483 if ( mBookmarkMenu->actions().value( i ) )
484 mBookmarkMenu->insertMenu( mBookmarkMenu->actions().at( i ), groupMenus.value( groupKeys.at( i ) ) );
486 mBookmarkMenu->addMenu( groupMenus.value( groupKeys.at( i ) ) );
490 void QgsLayoutMapWidget::mTemporalCheckBox_toggled(
bool checked )
497 mStartDateTime->setEnabled( checked );
498 mEndDateTime->setEnabled( checked );
500 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Toggle Temporal Range" ) );
501 mMapItem->setIsTemporal( checked );
502 mMapItem->layout()->undoStack()->endCommand();
506 whileBlocking( mStartDateTime )->setDateTime( mMapItem->temporalRange().begin() );
507 whileBlocking( mEndDateTime )->setDateTime( mMapItem->temporalRange().end() );
513 void QgsLayoutMapWidget::updateTemporalExtent()
520 QgsDateTimeRange range = QgsDateTimeRange( mStartDateTime->dateTime(), mEndDateTime->dateTime() );
522 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Set Temporal Range" ) );
523 mMapItem->setTemporalRange( range );
524 mMapItem->layout()->undoStack()->endCommand();
529 void QgsLayoutMapWidget::mAtlasCheckBox_toggled(
bool checked )
536 mAtlasFixedScaleRadio->setEnabled( checked );
537 mAtlasMarginRadio->setEnabled( checked );
539 if ( mAtlasMarginRadio->isEnabled() && mAtlasMarginRadio->isChecked() )
541 mAtlasMarginSpinBox->setEnabled(
true );
545 mAtlasMarginSpinBox->setEnabled(
false );
548 mAtlasPredefinedScaleRadio->setEnabled( checked );
553 if ( mMapItem->layout() )
555 toggleAtlasScalingOptionsByLayerType();
560 if ( !hasPredefinedScales() )
562 mAtlasPredefinedScaleRadio->setEnabled(
false );
565 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Set Atlas Driven" ) );
566 mMapItem->setAtlasDriven( checked );
567 mMapItem->layout()->undoStack()->endCommand();
571 void QgsLayoutMapWidget::updateMapForAtlas()
574 if ( mMapItem->atlasDriven() )
581 mMapItem->invalidateCache();
585 void QgsLayoutMapWidget::mAtlasMarginRadio_toggled(
bool checked )
587 mAtlasMarginSpinBox->setEnabled( checked );
589 if ( checked && mMapItem )
591 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
593 mMapItem->layout()->undoStack()->endCommand();
598 void QgsLayoutMapWidget::mAtlasMarginSpinBox_valueChanged(
int value )
606 mMapItem->setAtlasMargin( value / 100. );
607 mMapItem->layout()->undoStack()->endCommand();
611 void QgsLayoutMapWidget::mAtlasFixedScaleRadio_toggled(
bool checked )
620 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
622 mMapItem->layout()->undoStack()->endCommand();
627 void QgsLayoutMapWidget::mAtlasPredefinedScaleRadio_toggled(
bool checked )
634 if ( hasPredefinedScales() )
638 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Scales" ) );
640 mMapItem->layout()->undoStack()->endCommand();
648 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Atlas Mode" ) );
650 mMapItem->layout()->undoStack()->endCommand();
654 void QgsLayoutMapWidget::mScaleLineEdit_editingFinished()
661 bool conversionSuccess =
false;
662 double scaleDenominator = QLocale().toDouble( mScaleLineEdit->text(), &conversionSuccess );
663 if ( !conversionSuccess )
671 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Scale" ) );
672 mMapItem->setScale( scaleDenominator );
673 mMapItem->layout()->undoStack()->endCommand();
676 void QgsLayoutMapWidget::rotationChanged(
double value )
684 mMapItem->setMapRotation( value );
685 mMapItem->layout()->undoStack()->endCommand();
686 mMapItem->invalidateCache();
689 void QgsLayoutMapWidget::setToMapCanvasExtent()
706 newExtent = xForm.transformBoundingBox( newExtent );
715 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
716 mMapItem->zoomToExtent( newExtent );
717 mMapItem->layout()->undoStack()->endCommand();
720 void QgsLayoutMapWidget::setToMapCanvasScale()
727 const double newScale = mMapCanvas->
scale();
729 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Scale" ) );
730 mMapItem->setScale( newScale );
731 mMapItem->layout()->undoStack()->endCommand();
734 void QgsLayoutMapWidget::viewExtentInCanvas()
743 if ( !currentMapExtent.
isEmpty() )
758 void QgsLayoutMapWidget::viewScaleInCanvas()
765 const double currentScale = mMapItem->scale();
766 mMapCanvas->
zoomScale( currentScale,
true );
769 void QgsLayoutMapWidget::mXMinLineEdit_editingFinished()
771 updateComposerExtentFromGui();
774 void QgsLayoutMapWidget::mXMaxLineEdit_editingFinished()
776 updateComposerExtentFromGui();
779 void QgsLayoutMapWidget::mYMinLineEdit_editingFinished()
781 updateComposerExtentFromGui();
784 void QgsLayoutMapWidget::mYMaxLineEdit_editingFinished()
786 updateComposerExtentFromGui();
789 void QgsLayoutMapWidget::updateGuiElements()
796 blockAllSignals(
true );
797 mLabel->setText( mMapItem->displayName() );
799 whileBlocking( mCrsSelector )->setCrs( mMapItem->presetCrs() );
802 double scale = mMapItem->scale();
805 if ( scale >= 10000 )
808 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 0 ) );
810 else if ( scale >= 10 )
812 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 3 ) );
814 else if ( scale >= 1 )
817 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 4 ) );
822 mScaleLineEdit->setText( QLocale().toString( mMapItem->scale(),
'f', 10 ) );
827 mXMinLineEdit->setText( QLocale().toString( composerMapExtent.
xMinimum(),
'f', 3 ) );
828 mXMaxLineEdit->setText( QLocale().toString( composerMapExtent.
xMaximum(),
'f', 3 ) );
829 mYMinLineEdit->setText( QLocale().toString( composerMapExtent.
yMinimum(),
'f', 3 ) );
830 mYMaxLineEdit->setText( QLocale().toString( composerMapExtent.
yMaximum(),
'f', 3 ) );
835 mFollowVisibilityPresetCheckBox->setCheckState(
836 mMapItem->followVisibilityPreset() ? Qt::Checked : Qt::Unchecked );
837 int presetModelIndex = mFollowVisibilityPresetCombo->findText( mMapItem->followVisibilityPresetName() );
838 mFollowVisibilityPresetCombo->setCurrentIndex( presetModelIndex != -1 ? presetModelIndex : 0 );
841 if ( mMapItem->keepLayerSet() )
843 mKeepLayerListCheckBox->setCheckState( Qt::Checked );
847 mKeepLayerListCheckBox->setCheckState( Qt::Unchecked );
850 mKeepLayerStylesCheckBox->setEnabled( mMapItem->keepLayerSet() );
851 mKeepLayerStylesCheckBox->setCheckState( mMapItem->keepLayerStyles() ? Qt::Checked : Qt::Unchecked );
854 if ( mMapItem->drawAnnotations() )
856 mDrawCanvasItemsCheckBox->setCheckState( Qt::Checked );
860 mDrawCanvasItemsCheckBox->setCheckState( Qt::Unchecked );
864 mAtlasCheckBox->setChecked( mMapItem->atlasDriven() );
867 mAtlasFixedScaleRadio->setEnabled( mMapItem->atlasDriven() );
870 mAtlasMarginRadio->setEnabled( mMapItem->atlasDriven() );
872 mAtlasPredefinedScaleRadio->setEnabled( mMapItem->atlasDriven() );
875 if ( mMapItem->atlasDriven() )
877 toggleAtlasScalingOptionsByLayerType();
880 if ( !hasPredefinedScales() )
882 mAtlasPredefinedScaleRadio->setEnabled(
false );
885 mTemporalCheckBox->setChecked( mMapItem->isTemporal() );
886 mTemporalCheckBox->setCollapsed( !mMapItem->isTemporal() );
887 mStartDateTime->setEnabled( mMapItem->isTemporal() );
888 mEndDateTime->setEnabled( mMapItem->isTemporal() );
889 if ( mMapItem->isTemporal() )
891 mStartDateTime->setDateTime( mMapItem->temporalRange().begin() );
892 mEndDateTime->setDateTime( mMapItem->temporalRange().end() );
897 loadOverviewEntries();
899 blockAllSignals(
false );
902 void QgsLayoutMapWidget::toggleAtlasScalingOptionsByLayerType()
919 mAtlasFixedScaleRadio->setChecked(
true );
920 mAtlasMarginRadio->setEnabled(
false );
921 mAtlasPredefinedScaleRadio->setEnabled(
false );
926 mAtlasMarginRadio->setEnabled(
true );
927 mAtlasPredefinedScaleRadio->setEnabled(
true );
931 void QgsLayoutMapWidget::updateComposerExtentFromGui()
938 double xmin, ymin, xmax, ymax;
939 bool conversionSuccess;
941 xmin = QLocale().toDouble( mXMinLineEdit->text(), &conversionSuccess );
942 if ( !conversionSuccess )
944 xmax = QLocale().toDouble( mXMaxLineEdit->text(), &conversionSuccess );
945 if ( !conversionSuccess )
947 ymin = QLocale().toDouble( mYMinLineEdit->text(), &conversionSuccess );
948 if ( !conversionSuccess )
950 ymax = QLocale().toDouble( mYMaxLineEdit->text(), &conversionSuccess );
951 if ( !conversionSuccess )
956 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Extent" ) );
957 mMapItem->setExtent( newExtent );
958 mMapItem->layout()->undoStack()->endCommand();
961 void QgsLayoutMapWidget::blockAllSignals(
bool b )
963 mScaleLineEdit->blockSignals( b );
964 mXMinLineEdit->blockSignals( b );
965 mXMaxLineEdit->blockSignals( b );
966 mYMinLineEdit->blockSignals( b );
967 mYMaxLineEdit->blockSignals( b );
968 mDrawCanvasItemsCheckBox->blockSignals( b );
969 mOverviewFrameMapComboBox->blockSignals( b );
970 mOverviewFrameStyleButton->blockSignals( b );
971 mOverviewBlendModeComboBox->blockSignals( b );
972 mOverviewInvertCheckbox->blockSignals( b );
973 mOverviewCenterCheckbox->blockSignals( b );
974 mAtlasCheckBox->blockSignals( b );
975 mAtlasMarginSpinBox->blockSignals( b );
976 mAtlasFixedScaleRadio->blockSignals( b );
977 mAtlasMarginRadio->blockSignals( b );
978 mFollowVisibilityPresetCheckBox->blockSignals( b );
979 mFollowVisibilityPresetCombo->blockSignals( b );
980 mKeepLayerListCheckBox->blockSignals( b );
981 mKeepLayerStylesCheckBox->blockSignals( b );
982 mActionSetToCanvasExtent->blockSignals( b );
983 mActionUpdatePreview->blockSignals( b );
984 mTemporalCheckBox->blockSignals( b );
985 mStartDateTime->blockSignals( b );
986 mEndDateTime->blockSignals( b );
988 blockOverviewItemsSignals( b );
991 void QgsLayoutMapWidget::updatePreview()
1000 void QgsLayoutMapWidget::mFollowVisibilityPresetCheckBox_stateChanged(
int state )
1007 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
1008 if ( state == Qt::Checked )
1010 mMapItem->setFollowVisibilityPreset(
true );
1013 mKeepLayerListCheckBox->setCheckState( Qt::Unchecked );
1014 mKeepLayerStylesCheckBox->setCheckState( Qt::Unchecked );
1016 mMapItem->invalidateCache();
1020 mMapItem->setFollowVisibilityPreset(
false );
1022 mMapItem->layout()->undoStack()->endCommand();
1025 void QgsLayoutMapWidget::mKeepLayerListCheckBox_stateChanged(
int state )
1033 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Map Preset Changed" ) );
1034 storeCurrentLayerSet();
1035 mMapItem->setKeepLayerSet( state == Qt::Checked );
1036 if ( state == Qt::Unchecked )
1038 mMapItem->setLayers( QList< QgsMapLayer * >() );
1040 mMapItem->layout()->undoStack()->endCommand();
1043 if ( state == Qt::Checked )
1046 mFollowVisibilityPresetCheckBox->setCheckState( Qt::Unchecked );
1050 mKeepLayerStylesCheckBox->setChecked( Qt::Unchecked );
1051 mMapItem->invalidateCache();
1054 mKeepLayerStylesCheckBox->setEnabled( state == Qt::Checked );
1057 void QgsLayoutMapWidget::mKeepLayerStylesCheckBox_stateChanged(
int state )
1064 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Map Preset" ) );
1065 if ( state == Qt::Checked )
1067 mMapItem->storeCurrentLayerStyles();
1068 mMapItem->setKeepLayerStyles(
true );
1072 mMapItem->setLayerStyleOverrides( QMap<QString, QString>() );
1073 mMapItem->setKeepLayerStyles(
false );
1075 mMapItem->layout()->undoStack()->endCommand();
1078 void QgsLayoutMapWidget::mDrawCanvasItemsCheckBox_stateChanged(
int state )
1085 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Toggle Map Item" ) );
1086 mMapItem->setDrawAnnotations( state == Qt::Checked );
1087 mMapItem->invalidateCache();
1088 mMapItem->layout()->undoStack()->endCommand();
1091 void QgsLayoutMapWidget::atlasLayerChanged(
QgsVectorLayer *layer )
1096 mAtlasCheckBox->setChecked(
false );
1097 mAtlasCheckBox->setEnabled(
false );
1102 mAtlasCheckBox->setEnabled(
true );
1106 if ( mAtlasCheckBox->isChecked() )
1107 toggleAtlasScalingOptionsByLayerType();
1110 bool QgsLayoutMapWidget::hasPredefinedScales()
const
1115 if ( !hasProjectScales || scales.isEmpty() )
1120 QStringList myScalesList = scalesStr.split(
',' );
1121 return !myScalesList.isEmpty() && !myScalesList[0].isEmpty();
1126 void QgsLayoutMapWidget::mAddGridPushButton_clicked()
1133 QString itemName = tr(
"Grid %1" ).arg( mMapItem->grids()->size() + 1 );
1135 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Add Map Grid" ) );
1136 mMapItem->grids()->addGrid( grid );
1137 mMapItem->layout()->undoStack()->endCommand();
1138 mMapItem->updateBoundingRect();
1141 addGridListItem( grid->
id(), grid->
name() );
1142 mGridListWidget->setCurrentRow( 0 );
1143 mGridListWidget_currentItemChanged( mGridListWidget->currentItem(),
nullptr );
1146 void QgsLayoutMapWidget::mRemoveGridPushButton_clicked()
1148 QListWidgetItem *item = mGridListWidget->currentItem();
1154 mMapItem->beginCommand( tr(
"Remove Grid" ) );
1155 mMapItem->grids()->removeGrid( item->data( Qt::UserRole ).toString() );
1156 QListWidgetItem *delItem = mGridListWidget->takeItem( mGridListWidget->row( item ) );
1158 mMapItem->endCommand();
1159 mMapItem->updateBoundingRect();
1163 void QgsLayoutMapWidget::mGridUpButton_clicked()
1165 QListWidgetItem *item = mGridListWidget->currentItem();
1171 int row = mGridListWidget->row( item );
1176 mGridListWidget->takeItem( row );
1177 mGridListWidget->insertItem( row - 1, item );
1178 mGridListWidget->setCurrentItem( item );
1179 mMapItem->beginCommand( tr(
"Move Grid Up" ) );
1180 mMapItem->grids()->moveGridUp( item->data( Qt::UserRole ).toString() );
1181 mMapItem->endCommand();
1185 void QgsLayoutMapWidget::mGridDownButton_clicked()
1187 QListWidgetItem *item = mGridListWidget->currentItem();
1193 int row = mGridListWidget->row( item );
1194 if ( mGridListWidget->count() <= row )
1198 mGridListWidget->takeItem( row );
1199 mGridListWidget->insertItem( row + 1, item );
1200 mGridListWidget->setCurrentItem( item );
1201 mMapItem->beginCommand( tr(
"Move Grid Down" ) );
1202 mMapItem->grids()->moveGridDown( item->data( Qt::UserRole ).toString() );
1203 mMapItem->endCommand();
1214 QListWidgetItem *item = mGridListWidget->currentItem();
1219 return mMapItem->grids()->grid( item->data( Qt::UserRole ).toString() );
1222 void QgsLayoutMapWidget::mGridListWidget_currentItemChanged( QListWidgetItem *current, QListWidgetItem * )
1224 mGridPropertiesButton->setEnabled(
static_cast< bool >( current ) );
1227 void QgsLayoutMapWidget::mGridListWidget_itemChanged( QListWidgetItem *item )
1240 mMapItem->beginCommand( tr(
"Rename Grid" ) );
1241 grid->
setName( item->text() );
1242 mMapItem->endCommand();
1245 void QgsLayoutMapWidget::mGridPropertiesButton_clicked()
1262 QListWidgetItem *QgsLayoutMapWidget::addGridListItem(
const QString &
id,
const QString &name )
1264 QListWidgetItem *item =
new QListWidgetItem( name,
nullptr );
1265 item->setData( Qt::UserRole,
id );
1266 item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
1267 mGridListWidget->insertItem( 0, item );
1271 void QgsLayoutMapWidget::loadGridEntries()
1274 QSet<QString> selectedIds;
1275 QList<QListWidgetItem *> itemSelection = mGridListWidget->selectedItems();
1276 QList<QListWidgetItem *>::const_iterator sIt = itemSelection.constBegin();
1277 for ( ; sIt != itemSelection.constEnd(); ++sIt )
1279 selectedIds.insert( ( *sIt )->data( Qt::UserRole ).toString() );
1282 mGridListWidget->clear();
1288 QList< QgsLayoutItemMapGrid * > grids = mMapItem->grids()->asList();
1289 QList< QgsLayoutItemMapGrid * >::const_iterator gridIt = grids.constBegin();
1290 for ( ; gridIt != grids.constEnd(); ++gridIt )
1292 QListWidgetItem *item = addGridListItem( ( *gridIt )->id(), ( *gridIt )->name() );
1293 if ( selectedIds.contains( ( *gridIt )->id() ) )
1295 item->setSelected(
true );
1296 mGridListWidget->setCurrentItem( item );
1300 if ( mGridListWidget->currentItem() )
1302 mGridListWidget_currentItemChanged( mGridListWidget->currentItem(),
nullptr );
1306 mGridListWidget_currentItemChanged(
nullptr,
nullptr );
1310 void QgsLayoutMapWidget::mAddOverviewPushButton_clicked()
1317 QString itemName = tr(
"Overview %1" ).arg( mMapItem->overviews()->size() + 1 );
1319 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Add Map Overview" ) );
1320 mMapItem->overviews()->addOverview( overview );
1321 mMapItem->layout()->undoStack()->endCommand();
1322 mMapItem->invalidateCache();
1324 addOverviewListItem( overview->
id(), overview->
name() );
1326 mOverviewListWidget->setCurrentRow( 0 );
1329 void QgsLayoutMapWidget::mRemoveOverviewPushButton_clicked()
1331 QListWidgetItem *item = mOverviewListWidget->currentItem();
1336 mMapItem->beginCommand( tr(
"Remove Map Overview" ) );
1337 mMapItem->overviews()->removeOverview( item->data( Qt::UserRole ).toString() );
1338 mMapItem->endCommand();
1339 QListWidgetItem *delItem = mOverviewListWidget->takeItem( mOverviewListWidget->row( item ) );
1341 mMapItem->invalidateCache();
1344 void QgsLayoutMapWidget::mOverviewUpButton_clicked()
1346 QListWidgetItem *item = mOverviewListWidget->currentItem();
1352 int row = mOverviewListWidget->row( item );
1357 mOverviewListWidget->takeItem( row );
1358 mOverviewListWidget->insertItem( row - 1, item );
1359 mOverviewListWidget->setCurrentItem( item );
1360 mMapItem->beginCommand( tr(
"Move Overview Up" ) );
1361 mMapItem->overviews()->moveOverviewUp( item->data( Qt::UserRole ).toString() );
1362 mMapItem->endCommand();
1363 mMapItem->invalidateCache();
1366 void QgsLayoutMapWidget::mOverviewDownButton_clicked()
1368 QListWidgetItem *item = mOverviewListWidget->currentItem();
1374 int row = mOverviewListWidget->row( item );
1375 if ( mOverviewListWidget->count() <= row )
1379 mOverviewListWidget->takeItem( row );
1380 mOverviewListWidget->insertItem( row + 1, item );
1381 mOverviewListWidget->setCurrentItem( item );
1382 mMapItem->beginCommand( tr(
"Move Overview Down" ) );
1383 mMapItem->overviews()->moveOverviewDown( item->data( Qt::UserRole ).toString() );
1384 mMapItem->endCommand();
1385 mMapItem->invalidateCache();
1395 QListWidgetItem *item = mOverviewListWidget->currentItem();
1401 return mMapItem->overviews()->overview( item->data( Qt::UserRole ).toString() );
1404 void QgsLayoutMapWidget::mOverviewListWidget_currentItemChanged( QListWidgetItem *current, QListWidgetItem *previous )
1406 Q_UNUSED( previous )
1409 mOverviewCheckBox->setEnabled(
false );
1413 mOverviewCheckBox->setEnabled(
true );
1414 setOverviewItems( mMapItem->overviews()->overview( current->data( Qt::UserRole ).toString() ) );
1417 void QgsLayoutMapWidget::mOverviewListWidget_itemChanged( QListWidgetItem *item )
1430 mMapItem->beginCommand( QStringLiteral(
"Rename Overview" ) );
1431 overview->
setName( item->text() );
1432 mMapItem->endCommand();
1433 if ( item->isSelected() )
1436 mOverviewCheckBox->setTitle( QString( tr(
"Draw \"%1\" overview" ) ).arg( overview->
name() ) );
1440 void QgsLayoutMapWidget::setOverviewItemsEnabled(
bool enabled )
1442 mOverviewFrameMapLabel->setEnabled( enabled );
1443 mOverviewFrameMapComboBox->setEnabled( enabled );
1444 mOverviewFrameStyleLabel->setEnabled( enabled );
1445 mOverviewFrameStyleButton->setEnabled( enabled );
1446 mOverviewBlendModeLabel->setEnabled( enabled );
1447 mOverviewBlendModeComboBox->setEnabled( enabled );
1448 mOverviewInvertCheckbox->setEnabled( enabled );
1449 mOverviewCenterCheckbox->setEnabled( enabled );
1450 mOverviewPositionComboBox->setEnabled( enabled );
1456 void QgsLayoutMapWidget::blockOverviewItemsSignals(
const bool block )
1458 mOverviewFrameMapComboBox->blockSignals( block );
1459 mOverviewFrameStyleButton->blockSignals( block );
1460 mOverviewBlendModeComboBox->blockSignals( block );
1461 mOverviewInvertCheckbox->blockSignals( block );
1462 mOverviewCenterCheckbox->blockSignals( block );
1463 mOverviewPositionComboBox->blockSignals( block );
1464 mOverviewStackingLayerComboBox->blockSignals( block );
1474 blockOverviewItemsSignals(
true );
1476 mOverviewCheckBox->setTitle( QString( tr(
"Draw \"%1\" overview" ) ).arg( overview->
name() ) );
1477 mOverviewCheckBox->setChecked( overview->
enabled() );
1480 mOverviewFrameMapComboBox->setItem( overview->
linkedMap() );
1483 mOverviewBlendModeComboBox->setBlendMode( overview->
blendMode() );
1485 mOverviewInvertCheckbox->setChecked( overview->
inverted() );
1487 mOverviewCenterCheckbox->setChecked( overview->
centered() );
1489 mOverviewPositionComboBox->setCurrentIndex( mOverviewPositionComboBox->findData( overview->
stackingPosition() ) );
1490 mOverviewStackingLayerComboBox->setLayer( overview->
stackingLayer() );
1496 blockOverviewItemsSignals(
false );
1499 void QgsLayoutMapWidget::storeCurrentLayerSet()
1505 mMapItem->setLayers( layers );
1507 if ( mMapItem->keepLayerStyles() )
1510 mMapItem->storeCurrentLayerStyles();
1514 QList<QgsMapLayer *> QgsLayoutMapWidget::orderedPresetVisibleLayers(
const QString &name )
const
1519 QList<QgsMapLayer *> lst;
1523 if ( visibleIds.contains( layer->
id() ) )
1531 QListWidgetItem *QgsLayoutMapWidget::addOverviewListItem(
const QString &
id,
const QString &name )
1533 QListWidgetItem *item =
new QListWidgetItem( name,
nullptr );
1534 item->setData( Qt::UserRole,
id );
1535 item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
1536 mOverviewListWidget->insertItem( 0, item );
1540 void QgsLayoutMapWidget::loadOverviewEntries()
1543 QSet<QString> selectedIds;
1544 QList<QListWidgetItem *> itemSelection = mOverviewListWidget->selectedItems();
1545 QList<QListWidgetItem *>::const_iterator sIt = itemSelection.constBegin();
1546 for ( ; sIt != itemSelection.constEnd(); ++sIt )
1548 selectedIds.insert( ( *sIt )->data( Qt::UserRole ).toString() );
1551 mOverviewListWidget->clear();
1557 mOverviewFrameMapComboBox->setExceptedItemList( QList< QgsLayoutItem * >() << mMapItem );
1560 QList< QgsLayoutItemMapOverview * > overviews = mMapItem->overviews()->asList();
1561 QList< QgsLayoutItemMapOverview * >::const_iterator overviewIt = overviews.constBegin();
1562 for ( ; overviewIt != overviews.constEnd(); ++overviewIt )
1564 QListWidgetItem *item = addOverviewListItem( ( *overviewIt )->id(), ( *overviewIt )->name() );
1565 if ( selectedIds.contains( ( *overviewIt )->id() ) )
1567 item->setSelected(
true );
1568 mOverviewListWidget->setCurrentItem( item );
1572 if ( mOverviewListWidget->currentItem() )
1574 mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(),
nullptr );
1578 mOverviewListWidget_currentItemChanged(
nullptr,
nullptr );
1582 void QgsLayoutMapWidget::mOverviewCheckBox_toggled(
bool state )
1590 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Overview Display Toggled" ) );
1592 mMapItem->invalidateCache();
1593 mMapItem->layout()->undoStack()->endCommand();
1596 void QgsLayoutMapWidget::overviewMapChanged(
QgsLayoutItem *item )
1608 mMapItem->beginCommand( tr(
"Change Overview Map" ) );
1610 mMapItem->invalidateCache();
1611 mMapItem->endCommand();
1614 void QgsLayoutMapWidget::mOverviewBlendModeComboBox_currentIndexChanged(
int index )
1623 mMapItem->beginCommand( tr(
"Change Overview Blend Mode" ) );
1624 overview->
setBlendMode( mOverviewBlendModeComboBox->blendMode() );
1625 mMapItem->invalidateCache();
1626 mMapItem->endCommand();
1629 void QgsLayoutMapWidget::mOverviewInvertCheckbox_toggled(
bool state )
1637 mMapItem->beginCommand( tr(
"Toggle Overview Inverted" ) );
1639 mMapItem->invalidateCache();
1640 mMapItem->endCommand();
1643 void QgsLayoutMapWidget::mOverviewCenterCheckbox_toggled(
bool state )
1651 mMapItem->beginCommand( tr(
"Toggle Overview Centered" ) );
1653 mMapItem->invalidateCache();
1654 mMapItem->endCommand();
1657 void QgsLayoutMapWidget::overviewStackingChanged(
int )
1665 mMapItem->beginCommand( tr(
"Change Overview Position" ) );
1667 mMapItem->invalidateCache();
1668 mMapItem->endCommand();
1675 mOverviewStackingLayerComboBox->setEnabled(
false );
1680 mOverviewStackingLayerComboBox->setEnabled(
true );
1685 void QgsLayoutMapWidget::overviewStackingLayerChanged(
QgsMapLayer *layer )
1693 mMapItem->beginCommand( tr(
"Change Overview Position" ) );
1695 mMapItem->invalidateCache();
1696 mMapItem->endCommand();
1710 mLabelBoundarySpinBox->setClearValue( 0 );
1711 mLabelBoundarySpinBox->setShowClearButton(
true );
1713 mLabelBoundaryUnitsCombo->linkToWidget( mLabelBoundarySpinBox );
1714 mLabelBoundaryUnitsCombo->setConverter( &mMapItem->layout()->renderContext().measurementConverter() );
1717 connect( mLabelBoundarySpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutMapLabelingWidget::labelMarginChanged );
1718 connect( mShowPartialLabelsCheckBox, &QCheckBox::toggled,
this, &QgsLayoutMapLabelingWidget::showPartialsToggled );
1719 connect( mShowUnplacedCheckBox, &QCheckBox::toggled,
this, &QgsLayoutMapLabelingWidget::showUnplacedToggled );
1736 mMapItem = qobject_cast< QgsLayoutItemMap * >( item );
1743 updateGuiElements();
1748 void QgsLayoutMapLabelingWidget::updateGuiElements()
1750 whileBlocking( mLabelBoundarySpinBox )->setValue( mMapItem->labelMargin().length() );
1751 whileBlocking( mLabelBoundaryUnitsCombo )->setUnit( mMapItem->labelMargin().units() );
1755 if ( mBlockingItemsListView->model() )
1757 QAbstractItemModel *oldModel = mBlockingItemsListView->model();
1758 mBlockingItemsListView->setModel(
nullptr );
1759 oldModel->deleteLater();
1763 mBlockingItemsListView->setModel( model );
1768 void QgsLayoutMapLabelingWidget::labelMarginChanged(
double val )
1775 mMapItem->layout()->undoStack()->endCommand();
1776 mMapItem->invalidateCache();
1779 void QgsLayoutMapLabelingWidget::labelMarginUnitsChanged()
1785 mMapItem->setLabelMargin(
QgsLayoutMeasurement( mLabelBoundarySpinBox->value(), mLabelBoundaryUnitsCombo->unit() ) );
1786 mMapItem->layout()->undoStack()->endCommand();
1787 mMapItem->invalidateCache();
1790 void QgsLayoutMapLabelingWidget::showPartialsToggled(
bool checked )
1795 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Visibility" ) );
1796 QgsLayoutItemMap::MapItemFlags flags = mMapItem->mapFlags();
1801 mMapItem->setMapFlags( flags );
1802 mMapItem->layout()->undoStack()->endCommand();
1803 mMapItem->invalidateCache();
1806 void QgsLayoutMapLabelingWidget::showUnplacedToggled(
bool checked )
1811 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Visibility" ) );
1812 QgsLayoutItemMap::MapItemFlags flags = mMapItem->mapFlags();
1817 mMapItem->setMapFlags( flags );
1818 mMapItem->layout()->undoStack()->endCommand();
1819 mMapItem->invalidateCache();
1823 : QSortFilterProxyModel( parent )
1824 , mLayoutModel( layoutModel )
1827 setSourceModel( layoutModel );
1840 if ( i.column() != 0 )
1853 case Qt::CheckStateRole:
1854 switch ( i.column() )
1857 return mMapItem ? ( mMapItem->isLabelBlockingItem( item ) ? Qt::Checked : Qt::Unchecked ) : Qt::Unchecked;
1863 return mLayoutModel->
data( sourceIndex, role );
1871 if ( !index.isValid() )
1875 if ( !item || !mMapItem )
1880 mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr(
"Change Label Blocking Items" ) );
1882 if ( value.toBool() )
1884 mMapItem->addLabelBlockingItem( item );
1888 mMapItem->removeLabelBlockingItem( item );
1890 emit dataChanged( index, index, QVector<int>() << role );
1892 mMapItem->layout()->undoStack()->endCommand();
1893 mMapItem->invalidateCache();
1900 Qt::ItemFlags
flags = QAbstractItemModel::flags( index );
1902 if ( ! index.isValid() )
1907 switch ( index.column() )
1910 return flags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
1912 return flags | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
1919 if ( !item || item == mMapItem )