43 #include "qgsnative.h"
48 #include "qgsconfig.h"
79 #include <QDesktopServices>
80 #include <QMessageBox>
83 #include <QFileDialog>
85 #include <QFontDialog>
88 #include <QHeaderView>
89 #include <QColorDialog>
92 #include <QRegularExpressionValidator>
107 , mMessageBar( messageBar )
109 , mOriginalSubsetSQL( lyr->subsetString() )
112 connect( pbnQueryBuilder, &QPushButton::clicked,
this, &QgsVectorLayerProperties::pbnQueryBuilder_clicked );
113 connect( pbnIndex, &QPushButton::clicked,
this, &QgsVectorLayerProperties::pbnIndex_clicked );
115 connect( pbnUpdateExtents, &QPushButton::clicked,
this, &QgsVectorLayerProperties::pbnUpdateExtents_clicked );
116 connect( mButtonAddJoin, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonAddJoin_clicked );
117 connect( mButtonEditJoin, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonEditJoin_clicked );
118 connect( mJoinTreeWidget, &QTreeWidget::itemDoubleClicked,
this, &QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked );
119 connect( mButtonRemoveJoin, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonRemoveJoin_clicked );
120 connect( mButtonAddWmsDimension, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonAddWmsDimension_clicked );
121 connect( mButtonEditWmsDimension, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonEditWmsDimension_clicked );
122 connect( mWmsDimensionsTreeWidget, &QTreeWidget::itemDoubleClicked,
this, &QgsVectorLayerProperties::mWmsDimensionsTreeWidget_itemDoubleClicked );
123 connect( mButtonRemoveWmsDimension, &QPushButton::clicked,
this, &QgsVectorLayerProperties::mButtonRemoveWmsDimension_clicked );
124 connect( mSimplifyDrawingGroupBox, &QGroupBox::toggled,
this, &QgsVectorLayerProperties::mSimplifyDrawingGroupBox_toggled );
125 connect( buttonRemoveMetadataUrl, &QPushButton::clicked,
this, &QgsVectorLayerProperties::removeSelectedMetadataUrl );
126 connect( buttonAddMetadataUrl, &QPushButton::clicked,
this, &QgsVectorLayerProperties::addMetadataUrl );
127 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsVectorLayerProperties::showHelp );
134 mBtnStyle =
new QPushButton( tr(
"Style" ),
this );
135 QMenu *menuStyle =
new QMenu(
this );
136 mActionLoadStyle = menuStyle->addAction( tr(
"Load Style…" ) );
137 connect( mActionLoadStyle, &QAction::triggered,
this, &QgsVectorLayerProperties::loadStyle );
142 mActionSaveStyle = menuStyle->addAction( tr(
"Save Current Style…" ) );
143 mActionSaveMultipleStyles = menuStyle->addAction( tr(
"Save All Styles…" ) );
144 connect( mActionSaveMultipleStyles, &QAction::triggered,
this, &QgsVectorLayerProperties::saveMultipleStylesAs );
148 mActionSaveStyle = menuStyle->addAction( tr(
"Save Style…" ) );
150 connect( mActionSaveStyle, &QAction::triggered,
this, &QgsVectorLayerProperties::saveStyleAs );
152 mSourceGroupBox->hide();
154 menuStyle->addSeparator();
155 menuStyle->addAction( tr(
"Save as Default" ),
this, &QgsVectorLayerProperties::saveDefaultStyle_clicked );
156 menuStyle->addAction( tr(
"Restore Default" ),
this, &QgsVectorLayerProperties::loadDefaultStyle_clicked );
157 mBtnStyle->setMenu( menuStyle );
158 connect( menuStyle, &QMenu::aboutToShow,
this, &QgsVectorLayerProperties::aboutToShowStyleMenu );
159 buttonBox->addButton( mBtnStyle, QDialogButtonBox::ResetRole );
161 mBtnMetadata =
new QPushButton( tr(
"Metadata" ),
this );
162 QMenu *menuMetadata =
new QMenu(
this );
163 mActionLoadMetadata = menuMetadata->addAction( tr(
"Load Metadata…" ),
this, &QgsVectorLayerProperties::loadMetadata );
164 mActionSaveMetadataAs = menuMetadata->addAction( tr(
"Save Metadata…" ),
this, &QgsVectorLayerProperties::saveMetadataAs );
165 menuMetadata->addSeparator();
166 menuMetadata->addAction( tr(
"Save as Default" ),
this, &QgsVectorLayerProperties::saveDefaultMetadata );
167 menuMetadata->addAction( tr(
"Restore Default" ),
this, &QgsVectorLayerProperties::loadDefaultMetadata );
168 mBtnMetadata->setMenu( menuMetadata );
169 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
173 connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked,
this, &QgsVectorLayerProperties::apply );
174 connect(
this, &QDialog::accepted,
this, &QgsVectorLayerProperties::apply );
175 connect(
this, &QDialog::rejected,
this, &QgsVectorLayerProperties::onCancel );
183 mMapTipExpressionFieldWidget->setLayer( lyr );
184 mMapTipExpressionFieldWidget->registerExpressionContextGenerator(
this );
185 mDisplayExpressionWidget->setLayer( lyr );
186 mDisplayExpressionWidget->registerExpressionContextGenerator(
this );
188 connect( mInsertExpressionButton, &QAbstractButton::clicked,
this, &QgsVectorLayerProperties::insertFieldOrExpression );
193 QVBoxLayout *layout =
nullptr;
198 layout =
new QVBoxLayout( labelingFrame );
199 layout->setContentsMargins( 0, 0, 0, 0 );
201 labelingDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
203 layout->addWidget( labelingDialog );
204 labelingFrame->setLayout( layout );
207 layout =
new QVBoxLayout( mMaskingFrame );
208 layout->setContentsMargins( 0, 0, 0, 0 );
209 mMaskingWidget =
new QgsMaskingWidget( mMaskingFrame );
210 mMaskingWidget->setLayer( mLayer );
211 mMaskingWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
212 layout->addWidget( mMaskingWidget );
213 mMaskingFrame->setLayout( layout );
217 labelingDialog =
nullptr;
218 mOptsPage_Labels->setEnabled(
false );
219 mOptsPage_Masks->setEnabled(
false );
220 mGeomGroupBox->setEnabled(
false );
221 mGeomGroupBox->setVisible(
false );
222 mCrsGroupBox->setEnabled(
false );
223 mCrsGroupBox->setVisible(
false );
227 QVBoxLayout *actionLayout =
new QVBoxLayout( actionOptionsFrame );
228 actionLayout->setContentsMargins( 0, 0, 0, 0 );
230 mActionDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
231 actionLayout->addWidget( mActionDialog );
234 mSourceFieldsPropertiesDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
235 mSourceFieldsFrame->setLayout(
new QVBoxLayout( mSourceFieldsFrame ) );
236 mSourceFieldsFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
237 mSourceFieldsFrame->layout()->addWidget( mSourceFieldsPropertiesDialog );
242 mAttributesFormPropertiesDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
243 mAttributesFormFrame->setLayout(
new QVBoxLayout( mAttributesFormFrame ) );
244 mAttributesFormFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
245 mAttributesFormFrame->layout()->addWidget( mAttributesFormPropertiesDialog );
248 QVBoxLayout *metadataLayout =
new QVBoxLayout( metadataFrame );
249 metadataLayout->setContentsMargins( 0, 0, 0, 0 );
251 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
253 metadataLayout->addWidget( mMetadataWidget );
254 metadataFrame->setLayout( metadataLayout );
256 QVBoxLayout *temporalLayout =
new QVBoxLayout( temporalFrame );
257 temporalLayout->setContentsMargins( 0, 0, 0, 0 );
259 temporalLayout->addWidget( mTemporalWidget );
269 pbnIndex->setEnabled(
false );
273 pbnIndex->setEnabled(
false );
274 pbnIndex->setText( tr(
"Spatial Index Exists" ) );
281 int encindex = cboProviderEncoding->findText( enc );
284 cboProviderEncoding->insertItem( 0, enc );
287 cboProviderEncoding->setCurrentIndex( encindex );
289 else if ( mLayer->
providerType() == QLatin1String(
"ogr" ) )
294 cboProviderEncoding->setEnabled(
false );
299 mDataSourceEncodingFrame->hide();
303 mCrsSelector->setCrs( mLayer->
crs() );
306 const QList< QgsVectorLayerJoinInfo > &joins = mLayer->
vectorJoins();
309 addJoinToTreeWidget( join );
314 QVBoxLayout *diagLayout =
new QVBoxLayout( mDiagramFrame );
315 diagLayout->setContentsMargins( 0, 0, 0, 0 );
317 diagramPropertiesDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
319 diagLayout->addWidget( diagramPropertiesDialog );
320 mDiagramFrame->setLayout( diagLayout );
323 mLegendWidget->setMapCanvas( mCanvas );
324 mLegendWidget->setLayer( mLayer );
325 mLegendConfigEmbeddedWidget->setLayer( mLayer );
328 mLayerShortNameLineEdit->setText( mLayer->
shortName() );
331 mLayerShortNameLineEdit->setValidator( shortNameValidator );
334 mLayerTitleLineEdit->setText( mLayer->
title() );
335 mLayerAbstractTextEdit->setPlainText( mLayer->
abstract() );
336 mLayerKeywordListLineEdit->setText( mLayer->
keywordList() );
337 mLayerDataUrlLineEdit->setText( mLayer->
dataUrl() );
338 mLayerDataUrlFormatComboBox->setCurrentIndex(
339 mLayerDataUrlFormatComboBox->findText(
344 mLayerAttributionLineEdit->setText( mLayer->
attribution() );
345 mLayerAttributionUrlLineEdit->setText( mLayer->
attributionUrl() );
348 tableViewMetadataUrl->setSelectionMode( QAbstractItemView::SingleSelection );
349 tableViewMetadataUrl->setSelectionBehavior( QAbstractItemView::SelectRows );
350 tableViewMetadataUrl->horizontalHeader()->setStretchLastSection(
true );
351 tableViewMetadataUrl->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
353 mMetadataUrlModel =
new QStandardItemModel( tableViewMetadataUrl );
354 mMetadataUrlModel->clear();
355 mMetadataUrlModel->setColumnCount( 3 );
356 QStringList metadataUrlHeaders;
357 metadataUrlHeaders << tr(
"URL" ) << tr(
"Type" ) << tr(
"Format" );
358 mMetadataUrlModel->setHorizontalHeaderLabels( metadataUrlHeaders );
359 tableViewMetadataUrl->setModel( mMetadataUrlModel );
360 tableViewMetadataUrl->setItemDelegate(
new MetadataUrlItemDelegate(
this ) );
365 const int row = mMetadataUrlModel->rowCount();
366 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( metaUrl.url ) );
367 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( metaUrl.type ) );
368 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( metaUrl.format ) );
372 mLayerLegendUrlLineEdit->setText( mLayer->
legendUrl() );
373 mLayerLegendUrlFormatComboBox->setCurrentIndex(
374 mLayerLegendUrlFormatComboBox->findText(
381 const QList<QgsMapLayerServerProperties::WmsDimensionInfo> &wmsDims = serverProperties->
wmsDimensions();
384 addWmsDimensionInfoToTreeWidget( dim );
388 myStyle.append( QStringLiteral(
"body { margin: 10px; }\n " ) );
389 teMetadataViewer->clear();
390 teMetadataViewer->document()->setDefaultStyleSheet( myStyle );
391 teMetadataViewer->setHtml( htmlMetadata() );
392 teMetadataViewer->setOpenLinks(
false );
393 connect( teMetadataViewer, &QTextBrowser::anchorClicked,
this, &QgsVectorLayerProperties::urlClicked );
394 mMetadataFilled =
true;
399 if ( !settings.
contains( QStringLiteral(
"/Windows/VectorLayerProperties/tab" ) ) )
401 settings.
setValue( QStringLiteral(
"Windows/VectorLayerProperties/tab" ),
405 QString title = tr(
"Layer Properties — %1" ).arg( mLayer->
name() );
410 QList<QgsMapLayer *> dependencySources;
411 const QSet<QgsMapLayerDependency> constDependencies = mLayer->
dependencies();
416 dependencySources << layer;
422 connect(
QgsProject::instance(), &QObject::destroyed,
this, [ = ] {mLayersDependenciesTreeView->setModel(
nullptr );} );
423 mLayersDependenciesTreeView->setModel( mLayersDependenciesTreeModel );
425 connect( mRefreshLayerCheckBox, &QCheckBox::toggled, mRefreshLayerIntervalSpinBox, &QDoubleSpinBox::setEnabled );
428 QMenu *menu =
new QMenu(
this );
430 mAuxiliaryLayerActionNew =
new QAction( tr(
"Create" ),
this );
431 menu->addAction( mAuxiliaryLayerActionNew );
432 connect( mAuxiliaryLayerActionNew, &QAction::triggered,
this, &QgsVectorLayerProperties::onAuxiliaryLayerNew );
434 mAuxiliaryLayerActionClear =
new QAction( tr(
"Clear" ),
this );
435 menu->addAction( mAuxiliaryLayerActionClear );
436 connect( mAuxiliaryLayerActionClear, &QAction::triggered,
this, &QgsVectorLayerProperties::onAuxiliaryLayerClear );
438 mAuxiliaryLayerActionDelete =
new QAction( tr(
"Delete" ),
this );
439 menu->addAction( mAuxiliaryLayerActionDelete );
440 connect( mAuxiliaryLayerActionDelete, &QAction::triggered,
this, &QgsVectorLayerProperties::onAuxiliaryLayerDelete );
442 mAuxiliaryLayerActionExport =
new QAction( tr(
"Export" ),
this );
443 menu->addAction( mAuxiliaryLayerActionExport );
446 mAuxiliaryStorageActions->setMenu( menu );
448 connect( mAuxiliaryStorageFieldsDeleteBtn, &QPushButton::clicked,
this, &QgsVectorLayerProperties::onAuxiliaryLayerDeleteField );
449 connect( mAuxiliaryStorageFieldsAddBtn, &QPushButton::clicked,
this, &QgsVectorLayerProperties::onAuxiliaryLayerAddField );
451 updateAuxiliaryStoragePage();
453 mOptsPage_Information->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#information-properties" ) );
454 mOptsPage_Source->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#source-properties" ) );
455 mOptsPage_Style->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#symbology-properties" ) );
456 mOptsPage_Labels->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#labels-properties" ) );
457 mOptsPage_Masks->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#masks-properties" ) );
458 mOptsPage_Diagrams->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#diagrams-properties" ) );
459 mOptsPage_SourceFields->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#fields-properties" ) );
460 mOptsPage_AttributesForm->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#attributes-form-properties" ) );
461 mOptsPage_Joins->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#joins-properties" ) );
462 mOptsPage_AuxiliaryStorage->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#auxiliary-storage-properties" ) );
463 mOptsPage_Actions->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#actions-properties" ) );
464 mOptsPage_Display->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#display-properties" ) );
465 mOptsPage_Rendering->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#rendering-properties" ) );
466 mOptsPage_Variables->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#variables-properties" ) );
467 mOptsPage_Metadata->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#metadata-properties" ) );
468 mOptsPage_DataDependencies->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#dependencies-properties" ) ) ;
469 mOptsPage_Legend->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#legend-properties" ) );
470 mOptsPage_Server->setProperty(
"helpPage", QStringLiteral(
"working_with_vector/vector_properties.html#qgis-server-properties" ) );
476 void QgsVectorLayerProperties::toggleEditing()
481 emit toggleEditing( mLayer );
483 setPbnQueryBuilderEnabled();
497 mLayerPropertiesPages << page;
500 if ( beforePage.isEmpty() )
507 void QgsVectorLayerProperties::insertFieldOrExpression()
511 QString expression = QStringLiteral(
"[% " );
512 expression += mMapTipExpressionFieldWidget->asExpression();
513 expression += QLatin1String(
" %]" );
515 mMapTipWidget->insertText( expression );
518 void QgsVectorLayerProperties::addMetadataUrl()
520 const int row = mMetadataUrlModel->rowCount();
521 mMetadataUrlModel->setItem( row, 0,
new QStandardItem( QLatin1String() ) );
522 mMetadataUrlModel->setItem( row, 1,
new QStandardItem( QLatin1String() ) );
523 mMetadataUrlModel->setItem( row, 2,
new QStandardItem( QLatin1String() ) );
526 void QgsVectorLayerProperties::removeSelectedMetadataUrl()
528 const QModelIndexList selectedRows = tableViewMetadataUrl->selectionModel()->selectedRows();
529 if ( selectedRows.empty() )
531 mMetadataUrlModel->removeRow( selectedRows[0].row() );
535 void QgsVectorLayerProperties::syncToLayer()
537 if ( !mSourceWidget )
542 QHBoxLayout *layout =
new QHBoxLayout();
543 layout->addWidget( mSourceWidget );
544 mSourceGroupBox->setLayout( layout );
545 mSourceGroupBox->show();
549 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
550 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
559 mLayerOrigNameLineEdit->setText( mLayer->
name() );
560 mBackupCrs = mLayer->
crs();
562 mSubsetGroupBox->setEnabled(
true );
569 txtSubsetSQL->setReadOnly(
true );
570 txtSubsetSQL->setCaretWidth( 0 );
571 txtSubsetSQL->setCaretLineVisible(
false );
572 setPbnQueryBuilderEnabled();
580 mScaleRangeWidget->setMapCanvas( mCanvas );
583 mReferenceScaleWidget->setShowCurrentScaleButton(
true );
584 mReferenceScaleWidget->setMapCanvas( mCanvas );
585 if ( mUseReferenceScaleGroupBox->isChecked() )
588 mReferenceScaleWidget->setScale( mCanvas->
scale() );
593 mSimplifyDrawingSpinBox->setValue( simplifyMethod.
threshold() );
594 mSimplifyDrawingSpinBox->setClearValue( 1.0 );
596 QString remark = QStringLiteral(
" (%1)" ).arg( tr(
"Not supported" ) );
600 mSimplifyDrawingAtProvider->setChecked(
false );
601 mSimplifyDrawingAtProvider->setEnabled(
false );
602 if ( !mSimplifyDrawingAtProvider->text().endsWith( remark ) )
603 mSimplifyDrawingAtProvider->setText( mSimplifyDrawingAtProvider->text().append( remark ) );
608 mSimplifyDrawingAtProvider->setEnabled( mSimplifyDrawingGroupBox->isChecked() );
609 if ( mSimplifyDrawingAtProvider->text().endsWith( remark ) )
611 QString newText = mSimplifyDrawingAtProvider->text();
612 newText.chop( remark.size() );
613 mSimplifyDrawingAtProvider->setText( newText );
620 mSimplifyDrawingGroupBox->setChecked(
false );
621 mSimplifyDrawingGroupBox->setEnabled(
false );
628 mSimplifyAlgorithmComboBox->setCurrentIndex( mSimplifyAlgorithmComboBox->findData( simplifyMethod.
simplifyAlgorithm() ) );
631 myScalesList.append( QStringLiteral(
"1:1" ) );
632 mSimplifyMaximumScaleComboBox->updateScales( myScalesList );
633 mSimplifyMaximumScaleComboBox->setScale( simplifyMethod.
maximumScale() );
647 updateSymbologyPage();
651 if ( labelingDialog )
654 mSourceFieldsPropertiesDialog->
init();
655 mAttributesFormPropertiesDialog->
init();
658 updateVariableEditor();
660 if ( diagramPropertiesDialog )
664 const auto constMLayerPropertiesPages = mLayerPropertiesPages;
667 page->syncToLayer( mLayer );
674 mLegendWidget->setLayer( mLayer );
678 void QgsVectorLayerProperties::apply()
682 const QString newSource = mSourceWidget->
sourceUri();
683 if ( newSource != mLayer->
source() )
690 if ( labelingDialog )
694 mBackupCrs = mLayer->
crs();
696 mLegendWidget->applyToLayer();
697 mLegendConfigEmbeddedWidget->applyToLayer();
701 mMetadataFilled =
false;
704 if ( mMaskingWidget && mMaskingWidget->hasBeenPopulated() )
705 mMaskingWidget->apply();
710 mSubsetGroupBox->setEnabled(
true );
716 mMetadataFilled =
false;
738 const auto constActions = mActionDialog->
actions();
739 for (
const QgsAction &action : constActions )
746 QVector<QgsAttributeTableConfig::ColumnConfig> columns = attributeTableConfig.
columns();
748 for (
int i = 0; i < columns.size(); ++i )
760 mLayer->
setName( mLayerOrigNameLineEdit->text() );
762 mAttributesFormPropertiesDialog->
apply();
763 mSourceFieldsPropertiesDialog->
apply();
775 diagramPropertiesDialog->
apply();
778 const auto constMLayerPropertiesPages = mLayerPropertiesPages;
785 if ( mLayer->
shortName() != mLayerShortNameLineEdit->text() )
786 mMetadataFilled =
false;
787 mLayer->
setShortName( mLayerShortNameLineEdit->text() );
789 if ( mLayer->
title() != mLayerTitleLineEdit->text() )
790 mMetadataFilled =
false;
791 mLayer->
setTitle( mLayerTitleLineEdit->text() );
793 if ( mLayer->
abstract() != mLayerAbstractTextEdit->toPlainText() )
794 mMetadataFilled =
false;
795 mLayer->
setAbstract( mLayerAbstractTextEdit->toPlainText() );
797 if ( mLayer->
keywordList() != mLayerKeywordListLineEdit->text() )
798 mMetadataFilled =
false;
801 if ( mLayer->
dataUrl() != mLayerDataUrlLineEdit->text() )
802 mMetadataFilled =
false;
803 mLayer->
setDataUrl( mLayerDataUrlLineEdit->text() );
805 if ( mLayer->
dataUrlFormat() != mLayerDataUrlFormatComboBox->currentText() )
806 mMetadataFilled =
false;
810 if ( mLayer->
attribution() != mLayerAttributionLineEdit->text() )
811 mMetadataFilled =
false;
814 if ( mLayer->
attributionUrl() != mLayerAttributionUrlLineEdit->text() )
815 mMetadataFilled =
false;
819 QList<QgsMapLayerServerProperties::MetadataUrl> metaUrls;
820 for (
int row = 0; row < mMetadataUrlModel->rowCount() ; row++ )
823 metaUrl.
url = mMetadataUrlModel->item( row, 0 )->text();
824 metaUrl.
type = mMetadataUrlModel->item( row, 1 )->text();
825 metaUrl.
format = mMetadataUrlModel->item( row, 2 )->text();
826 metaUrls.append( metaUrl );
827 mMetadataFilled =
false;
832 if ( mLayer->
legendUrl() != mLayerLegendUrlLineEdit->text() )
833 mMetadataFilled =
false;
834 mLayer->
setLegendUrl( mLayerLegendUrlLineEdit->text() );
836 if ( mLayer->
legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
837 mMetadataFilled =
false;
842 if ( mSimplifyDrawingGroupBox->isChecked() )
850 simplifyMethod.
setThreshold( mSimplifyDrawingSpinBox->value() );
852 simplifyMethod.
setMaximumScale( mSimplifyMaximumScaleComboBox->scale() );
865 mLayer->
setRefreshOnNofifyMessage( mNotificationMessageCheckBox->isChecked() ? mNotifyMessagValueLineEdit->text() : QString() );
871 updateVariableEditor();
874 QSet<QgsMapLayerDependency> deps;
875 const auto checkedLayers = mLayersDependenciesTreeModel->
checkedLayers();
880 QMessageBox::warning(
nullptr, tr(
"Save Dependency" ), tr(
"This configuration introduces a cycle in data dependencies and will be ignored." ) );
888 void QgsVectorLayerProperties::onCancel()
895 const auto constVectorJoins = mLayer->
vectorJoins();
915 QDomDocument doc( QStringLiteral(
"qgis" ) );
916 int errorLine, errorColumn;
917 doc.setContent( mOldStyle.
xmlData(),
false, &myMessage, &errorLine, &errorColumn );
921 if ( mBackupCrs != mLayer->
crs() )
922 mLayer->
setCrs( mBackupCrs );
925 void QgsVectorLayerProperties::urlClicked(
const QUrl &url )
927 QFileInfo file( url.toLocalFile() );
928 if ( file.exists() && !file.isDir() )
931 QDesktopServices::openUrl( url );
934 void QgsVectorLayerProperties::pbnQueryBuilder_clicked()
943 if ( dialog->exec() )
957 void QgsVectorLayerProperties::pbnIndex_clicked()
962 setCursor( Qt::WaitCursor );
964 setCursor( Qt::ArrowCursor );
967 pbnIndex->setEnabled(
false );
968 pbnIndex->setText( tr(
"Spatial Index Exists" ) );
969 QMessageBox::information(
this, tr(
"Spatial Index" ), tr(
"Creation of spatial index successful" ) );
973 QMessageBox::warning(
this, tr(
"Spatial Index" ), tr(
"Creation of spatial index failed" ) );
978 QString QgsVectorLayerProperties::htmlMetadata()
988 mMetadataFilled =
false;
992 void QgsVectorLayerProperties::loadDefaultStyle_clicked()
995 bool defaultLoadedFlag =
false;
1002 QMessageBox askToUser;
1003 askToUser.setText( tr(
"Load default style from: " ) );
1004 askToUser.setIcon( QMessageBox::Question );
1005 askToUser.addButton( tr(
"Cancel" ), QMessageBox::RejectRole );
1006 askToUser.addButton( tr(
"Local Database" ), QMessageBox::NoRole );
1007 askToUser.addButton( tr(
"Datasource Database" ), QMessageBox::YesRole );
1009 switch ( askToUser.exec() )
1015 if ( !defaultLoadedFlag )
1018 QMessageBox::information(
this, tr(
"Default Style" ), msg );
1020 if ( msg.compare( tr(
"Loaded from Provider" ) ) )
1022 QMessageBox::information(
this, tr(
"Default Style" ),
1023 tr(
"No default style was found for this layer." ) );
1039 if ( defaultLoadedFlag )
1047 QMessageBox::information(
this, tr(
"Default Style" ), myMessage );
1051 void QgsVectorLayerProperties::saveDefaultStyle_clicked()
1060 QMessageBox askToUser;
1061 askToUser.setText( tr(
"Save default style to: " ) );
1062 askToUser.setIcon( QMessageBox::Question );
1063 askToUser.addButton( tr(
"Cancel" ), QMessageBox::RejectRole );
1064 askToUser.addButton( tr(
"Local Database" ), QMessageBox::NoRole );
1065 askToUser.addButton( tr(
"Datasource Database" ), QMessageBox::YesRole );
1067 switch ( askToUser.exec() )
1073 if ( errorMsg.isNull() )
1083 bool defaultSavedFlag =
false;
1085 if ( !defaultSavedFlag )
1087 QMessageBox::warning(
this, tr(
"Default Style" ), errorMsg );
1091 void QgsVectorLayerProperties::loadMetadata()
1094 QString myLastUsedDir = myQSettings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1096 QString myFileName = QFileDialog::getOpenFileName(
this, tr(
"Load Layer Metadata from Metadata File" ), myLastUsedDir,
1097 tr(
"QGIS Layer Metadata File" ) +
" (*.qmd)" );
1098 if ( myFileName.isNull() )
1104 bool defaultLoadedFlag =
false;
1108 if ( defaultLoadedFlag )
1115 QMessageBox::warning(
this, tr(
"Load Metadata" ), myMessage );
1118 QFileInfo myFI( myFileName );
1119 QString myPath = myFI.path();
1120 myQSettings.
setValue( QStringLiteral(
"style/lastStyleDir" ), myPath );
1125 void QgsVectorLayerProperties::saveMetadataAs()
1128 QString myLastUsedDir = myQSettings.
value( QStringLiteral(
"style/lastStyleDir" ), QDir::homePath() ).toString();
1130 QString myOutputFileName = QFileDialog::getSaveFileName(
this, tr(
"Save Layer Metadata as QMD" ),
1131 myLastUsedDir, tr(
"QMD File" ) +
" (*.qmd)" );
1132 if ( myOutputFileName.isNull() )
1146 bool defaultLoadedFlag =
false;
1150 if ( defaultLoadedFlag )
1157 QMessageBox::information(
this, tr(
"Save Metadata" ), myMessage );
1160 QFileInfo myFI( myOutputFileName );
1161 QString myPath = myFI.path();
1163 myQSettings.
setValue( QStringLiteral(
"style/lastStyleDir" ), myPath );
1166 void QgsVectorLayerProperties::saveDefaultMetadata()
1170 bool defaultSavedFlag =
false;
1172 if ( !defaultSavedFlag )
1174 QMessageBox::warning(
this, tr(
"Default Metadata" ), errorMsg );
1178 void QgsVectorLayerProperties::loadDefaultMetadata()
1180 bool defaultLoadedFlag =
false;
1183 if ( defaultLoadedFlag )
1189 QMessageBox::information(
this, tr(
"Default Metadata" ), myMessage );
1194 void QgsVectorLayerProperties::saveStyleAs()
1205 bool defaultLoadedFlag =
false;
1207 StyleType type = dlg.currentStyleType();
1214 QString filePath = dlg.outputFilePath();
1216 message = mLayer->
saveNamedStyle( filePath, defaultLoadedFlag, dlg.styleCategories() );
1218 message = mLayer->
saveSldStyle( filePath, defaultLoadedFlag );
1221 if ( defaultLoadedFlag )
1228 QMessageBox::information(
this, tr(
"Save Style" ), message );
1235 QString infoWindowTitle = QObject::tr(
"Save style to DB (%1)" ).arg( mLayer->
providerType() );
1242 if ( !msgError.isNull() )
1244 mMessageBar->
pushMessage( infoWindowTitle, msgError, Qgis::MessageLevel::Warning );
1248 mMessageBar->
pushMessage( infoWindowTitle, tr(
"Style saved" ), Qgis::MessageLevel::Success );
1256 void QgsVectorLayerProperties::saveMultipleStylesAs()
1259 dlg.setSaveOnlyCurrentStyle(
false );
1268 const QListWidget *stylesWidget { dlg.stylesWidget() };
1271 QStringList stylesSelected;
1272 for (
int i = 0; i < stylesWidget->count(); i++ )
1274 if ( stylesWidget->item( i )->checkState() == Qt::CheckState::Checked )
1276 stylesSelected.push_back( stylesWidget->item( i )->text() );
1280 if ( ! stylesSelected.isEmpty() )
1283 for (
const QString &styleName : std::as_const( stylesSelected ) )
1285 bool defaultLoadedFlag =
false;
1287 StyleType type = dlg.currentStyleType();
1295 const QString filePath { dlg.outputFilePath() };
1296 QString safePath { filePath };
1297 if ( styleIndex > 0 && stylesSelected.count( ) > 1 )
1300 while ( QFile::exists( safePath ) )
1302 const QFileInfo fi { filePath };
1303 safePath = QString( filePath ).replace(
'.' + fi.completeSuffix(), QStringLiteral(
"_%1.%2" )
1304 .arg( QString::number( i ) )
1305 .arg( fi.completeSuffix() ) );
1310 message = mLayer->
saveNamedStyle( safePath, defaultLoadedFlag, dlg.styleCategories() );
1312 message = mLayer->
saveSldStyle( safePath, defaultLoadedFlag );
1315 if ( defaultLoadedFlag )
1322 QMessageBox::information(
this, tr(
"Save Style" ), message );
1329 QString infoWindowTitle = QObject::tr(
"Save style '%1' to DB (%2)" )
1337 QString name { dbSettings.
name };
1338 if ( name.isEmpty() )
1344 QStringList ids, names, descriptions;
1347 while ( names.contains( name ) )
1349 name = QStringLiteral(
"%1 %2" ).arg( name ).arg( QString::number( i ) );
1355 if ( !msgError.isNull() )
1357 mMessageBar->
pushMessage( infoWindowTitle, msgError, Qgis::MessageLevel::Warning );
1361 mMessageBar->
pushMessage( infoWindowTitle, tr(
"Style '%1' saved" ).arg( styleName ),
1362 Qgis::MessageLevel::Success );
1375 void QgsVectorLayerProperties::aboutToShowStyleMenu()
1378 QMenu *m = qobject_cast<QMenu *>( sender() );
1386 void QgsVectorLayerProperties::loadStyle()
1391 QStringList ids, names, descriptions;
1396 dlg.initializeLists( ids, names, descriptions, sectionLimit );
1401 QgsMapLayer::StyleCategories categories = dlg.styleCategories();
1402 StyleType type = dlg.currentStyleType();
1409 bool defaultLoadedFlag =
false;
1410 QString filePath = dlg.filePath();
1413 message = mLayer->
loadSldStyle( filePath, defaultLoadedFlag );
1417 message = mLayer->
loadNamedStyle( filePath, defaultLoadedFlag,
true, categories );
1420 if ( defaultLoadedFlag )
1427 QMessageBox::warning(
this, tr(
"Load Style" ), message );
1433 QString selectedStyleId = dlg.selectedStyleId();
1436 if ( !errorMsg.isNull() )
1438 QMessageBox::warning(
this, tr(
"Load Styles from Database" ), errorMsg );
1442 QDomDocument myDocument( QStringLiteral(
"qgis" ) );
1443 myDocument.setContent( qmlStyle );
1451 QMessageBox::warning(
this, tr(
"Load Styles from Database" ),
1452 tr(
"The retrieved style is not a valid named style. Error message: %1" )
1462 void QgsVectorLayerProperties::mButtonAddJoin_clicked()
1467 QList<QgsMapLayer *> joinedLayers;
1468 const QList< QgsVectorLayerJoinInfo > &joins = mLayer->
vectorJoins();
1469 joinedLayers.reserve( joins.size() );
1470 for (
int i = 0; i < joins.size(); ++i )
1472 joinedLayers.append( joins[i].joinLayer() );
1476 if ( d.exec() == QDialog::Accepted )
1480 if ( d.createAttributeIndex() )
1489 addJoinToTreeWidget( info );
1490 setPbnQueryBuilderEnabled();
1491 mSourceFieldsPropertiesDialog->
init();
1492 mAttributesFormPropertiesDialog->
init();
1496 void QgsVectorLayerProperties::mButtonEditJoin_clicked()
1498 QTreeWidgetItem *currentJoinItem = mJoinTreeWidget->currentItem();
1499 mJoinTreeWidget_itemDoubleClicked( currentJoinItem, 0 );
1502 void QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked( QTreeWidgetItem *item,
int )
1504 if ( !mLayer || !item )
1509 QList<QgsMapLayer *> joinedLayers;
1510 QString joinLayerId = item->data( 0, Qt::UserRole ).toString();
1511 const QList< QgsVectorLayerJoinInfo > &joins = mLayer->
vectorJoins();
1513 for (
int i = 0; i < joins.size(); ++i )
1519 if ( joinLayer->
id() == joinLayerId )
1526 joinedLayers.append( joinLayer );
1535 d.setWindowTitle( tr(
"Edit Vector Join" ) );
1536 d.setJoinInfo( joins[j] );
1538 if ( d.exec() == QDialog::Accepted )
1544 int idx = mJoinTreeWidget->indexOfTopLevelItem( item );
1545 mJoinTreeWidget->takeTopLevelItem( idx );
1550 if ( d.createAttributeIndex() )
1559 addJoinToTreeWidget( info, idx );
1561 setPbnQueryBuilderEnabled();
1562 mSourceFieldsPropertiesDialog->
init();
1563 mAttributesFormPropertiesDialog->
init();
1567 void QgsVectorLayerProperties::addJoinToTreeWidget(
const QgsVectorLayerJoinInfo &join,
const int insertIndex )
1569 QTreeWidgetItem *joinItem =
new QTreeWidgetItem();
1570 joinItem->setFlags( Qt::ItemIsEnabled );
1573 if ( !mLayer || !joinLayer )
1578 joinItem->setText( 0, tr(
"Join layer" ) );
1584 joinItem->setText( 1, joinLayer->
name() );
1586 QFont f = joinItem->font( 0 );
1588 joinItem->setFont( 0, f );
1589 joinItem->setFont( 1, f );
1591 joinItem->setData( 0, Qt::UserRole, join.
joinLayerId() );
1593 QTreeWidgetItem *childJoinField =
new QTreeWidgetItem();
1594 childJoinField->setText( 0, tr(
"Join field" ) );
1596 childJoinField->setFlags( Qt::ItemIsEnabled );
1597 joinItem->addChild( childJoinField );
1599 QTreeWidgetItem *childTargetField =
new QTreeWidgetItem();
1600 childTargetField->setText( 0, tr(
"Target field" ) );
1602 joinItem->addChild( childTargetField );
1604 QTreeWidgetItem *childMemCache =
new QTreeWidgetItem();
1605 childMemCache->setText( 0, tr(
"Cache join layer in virtual memory" ) );
1607 childMemCache->setText( 1, QChar( 0x2714 ) );
1608 joinItem->addChild( childMemCache );
1610 QTreeWidgetItem *childDynForm =
new QTreeWidgetItem();
1611 childDynForm->setText( 0, tr(
"Dynamic form" ) );
1613 childDynForm->setText( 1, QChar( 0x2714 ) );
1614 joinItem->addChild( childDynForm );
1616 QTreeWidgetItem *childEditable =
new QTreeWidgetItem();
1617 childEditable->setText( 0, tr(
"Editable join layer" ) );
1619 childEditable->setText( 1, QChar( 0x2714 ) );
1620 joinItem->addChild( childEditable );
1622 QTreeWidgetItem *childUpsert =
new QTreeWidgetItem();
1623 childUpsert->setText( 0, tr(
"Upsert on edit" ) );
1625 childUpsert->setText( 1, QChar( 0x2714 ) );
1626 joinItem->addChild( childUpsert );
1628 QTreeWidgetItem *childCascade =
new QTreeWidgetItem();
1629 childCascade->setText( 0, tr(
"Delete cascade" ) );
1631 childCascade->setText( 1, QChar( 0x2714 ) );
1632 joinItem->addChild( childCascade );
1634 QTreeWidgetItem *childPrefix =
new QTreeWidgetItem();
1635 childPrefix->setText( 0, tr(
"Custom field name prefix" ) );
1636 childPrefix->setText( 1, join.
prefix() );
1637 joinItem->addChild( childPrefix );
1639 QTreeWidgetItem *childFields =
new QTreeWidgetItem();
1640 childFields->setText( 0, tr(
"Joined fields" ) );
1643 childFields->setText( 1, QLocale().toString( list->count() ) );
1645 childFields->setText( 1, tr(
"all" ) );
1646 joinItem->addChild( childFields );
1648 if ( insertIndex >= 0 )
1649 mJoinTreeWidget->insertTopLevelItem( insertIndex, joinItem );
1651 mJoinTreeWidget->addTopLevelItem( joinItem );
1653 mJoinTreeWidget->setCurrentItem( joinItem );
1654 mJoinTreeWidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
1662 void QgsVectorLayerProperties::openPanel(
QgsPanelWidget *panel )
1664 QDialog *dlg =
new QDialog();
1665 QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
1667 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
1669 dlg->setLayout(
new QVBoxLayout() );
1670 dlg->layout()->addWidget( panel );
1671 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
1672 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
1673 dlg->layout()->addWidget( buttonBox );
1675 settings.
setValue( key, dlg->saveGeometry() );
1679 void QgsVectorLayerProperties::mButtonRemoveJoin_clicked()
1681 QTreeWidgetItem *currentJoinItem = mJoinTreeWidget->currentItem();
1682 if ( !mLayer || !currentJoinItem )
1687 mLayer->
removeJoin( currentJoinItem->data( 0, Qt::UserRole ).toString() );
1688 mJoinTreeWidget->takeTopLevelItem( mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem ) );
1689 setPbnQueryBuilderEnabled();
1690 mSourceFieldsPropertiesDialog->
init();
1691 mAttributesFormPropertiesDialog->
init();
1695 void QgsVectorLayerProperties::mButtonAddWmsDimension_clicked()
1701 QStringList alreadyDefinedDimensions;
1703 const QList<QgsMapLayerServerProperties::WmsDimensionInfo> &dims = serverProperties->
wmsDimensions();
1706 alreadyDefinedDimensions << dim.name;
1710 if ( d.exec() == QDialog::Accepted )
1715 addWmsDimensionInfoToTreeWidget( info );
1719 void QgsVectorLayerProperties::mButtonEditWmsDimension_clicked()
1721 QTreeWidgetItem *currentWmsDimensionItem = mWmsDimensionsTreeWidget->currentItem();
1722 mWmsDimensionsTreeWidget_itemDoubleClicked( currentWmsDimensionItem, 0 );
1725 void QgsVectorLayerProperties::mWmsDimensionsTreeWidget_itemDoubleClicked( QTreeWidgetItem *item,
int )
1727 if ( !mLayer || !item )
1732 QString wmsDimName = item->data( 0, Qt::UserRole ).toString();
1734 const QList<QgsMapLayerServerProperties::WmsDimensionInfo> &dims = serverProperties->
wmsDimensions();
1735 QStringList alreadyDefinedDimensions;
1737 for (
int i = 0; i < dims.size(); ++i )
1739 QString dimName = dims[i].name;
1740 if ( dimName == wmsDimName )
1746 alreadyDefinedDimensions << dimName;
1755 d.setWindowTitle( tr(
"Edit WMS Dimension" ) );
1756 d.setInfo( dims[j] );
1758 if ( d.exec() == QDialog::Accepted )
1765 int idx = mWmsDimensionsTreeWidget->indexOfTopLevelItem( item );
1766 mWmsDimensionsTreeWidget->takeTopLevelItem( idx );
1770 addWmsDimensionInfoToTreeWidget( info, idx );
1776 QTreeWidgetItem *wmsDimensionItem =
new QTreeWidgetItem();
1777 wmsDimensionItem->setFlags( Qt::ItemIsEnabled );
1779 wmsDimensionItem->setText( 0, tr(
"Dimension" ) );
1780 wmsDimensionItem->setText( 1, wmsDim.
name );
1782 QFont f = wmsDimensionItem->font( 0 );
1784 wmsDimensionItem->setFont( 0, f );
1785 wmsDimensionItem->setFont( 1, f );
1787 wmsDimensionItem->setData( 0, Qt::UserRole, wmsDim.
name );
1789 QTreeWidgetItem *childWmsDimensionField =
new QTreeWidgetItem();
1790 childWmsDimensionField->setText( 0, tr(
"Field" ) );
1791 childWmsDimensionField->setText( 1, wmsDim.
fieldName );
1792 childWmsDimensionField->setFlags( Qt::ItemIsEnabled );
1793 wmsDimensionItem->addChild( childWmsDimensionField );
1795 QTreeWidgetItem *childWmsDimensionEndField =
new QTreeWidgetItem();
1796 childWmsDimensionEndField->setText( 0, tr(
"End field" ) );
1797 childWmsDimensionEndField->setText( 1, wmsDim.
endFieldName );
1798 childWmsDimensionEndField->setFlags( Qt::ItemIsEnabled );
1799 wmsDimensionItem->addChild( childWmsDimensionEndField );
1801 QTreeWidgetItem *childWmsDimensionUnits =
new QTreeWidgetItem();
1802 childWmsDimensionUnits->setText( 0, tr(
"Units" ) );
1803 childWmsDimensionUnits->setText( 1, wmsDim.
units );
1804 childWmsDimensionUnits->setFlags( Qt::ItemIsEnabled );
1805 wmsDimensionItem->addChild( childWmsDimensionUnits );
1807 QTreeWidgetItem *childWmsDimensionUnitSymbol =
new QTreeWidgetItem();
1808 childWmsDimensionUnitSymbol->setText( 0, tr(
"Unit symbol" ) );
1809 childWmsDimensionUnitSymbol->setText( 1, wmsDim.
unitSymbol );
1810 childWmsDimensionUnitSymbol->setFlags( Qt::ItemIsEnabled );
1811 wmsDimensionItem->addChild( childWmsDimensionUnitSymbol );
1813 QTreeWidgetItem *childWmsDimensionDefaultValue =
new QTreeWidgetItem();
1814 childWmsDimensionDefaultValue->setText( 0, tr(
"Default display" ) );
1816 childWmsDimensionDefaultValue->setFlags( Qt::ItemIsEnabled );
1817 wmsDimensionItem->addChild( childWmsDimensionDefaultValue );
1819 QTreeWidgetItem *childWmsDimensionRefValue =
new QTreeWidgetItem();
1820 childWmsDimensionRefValue->setText( 0, tr(
"Reference value" ) );
1821 childWmsDimensionRefValue->setText( 1, wmsDim.
referenceValue.toString() );
1822 childWmsDimensionRefValue->setFlags( Qt::ItemIsEnabled );
1823 wmsDimensionItem->addChild( childWmsDimensionRefValue );
1825 if ( insertIndex >= 0 )
1826 mWmsDimensionsTreeWidget->insertTopLevelItem( insertIndex, wmsDimensionItem );
1828 mWmsDimensionsTreeWidget->addTopLevelItem( wmsDimensionItem );
1830 mWmsDimensionsTreeWidget->setCurrentItem( wmsDimensionItem );
1831 mWmsDimensionsTreeWidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
1834 void QgsVectorLayerProperties::mButtonRemoveWmsDimension_clicked()
1836 QTreeWidgetItem *currentWmsDimensionItem = mWmsDimensionsTreeWidget->currentItem();
1837 if ( !mLayer || !currentWmsDimensionItem )
1843 serverProperties->
removeWmsDimension( currentWmsDimensionItem->data( 0, Qt::UserRole ).toString() );
1844 mWmsDimensionsTreeWidget->takeTopLevelItem( mWmsDimensionsTreeWidget->indexOfTopLevelItem( currentWmsDimensionItem ) );
1848 void QgsVectorLayerProperties::updateSymbologyPage()
1852 delete mRendererDialog;
1853 mRendererDialog =
nullptr;
1869 mOptsPage_Style->setEnabled(
false );
1872 if ( mRendererDialog )
1874 mRendererDialog->layout()->setContentsMargins( 0, 0, 0, 0 );
1875 widgetStackRenderers->addWidget( mRendererDialog );
1876 widgetStackRenderers->setCurrentWidget( mRendererDialog );
1877 widgetStackRenderers->currentWidget()->layout()->setContentsMargins( 0, 0, 0, 0 );
1881 void QgsVectorLayerProperties::setPbnQueryBuilderEnabled()
1883 pbnQueryBuilder->setEnabled( mLayer &&
1890 pbnQueryBuilder->setToolTip( tr(
"Stop editing mode to enable this." ) );
1895 void QgsVectorLayerProperties::pbnUpdateExtents_clicked()
1898 mMetadataFilled =
false;
1905 bool isMetadataPanel = ( index ==
mOptStackedWidget->indexOf( mOptsPage_Metadata ) );
1906 mBtnStyle->setVisible( ! isMetadataPanel );
1907 mBtnMetadata->setVisible( isMetadataPanel );
1909 if ( index ==
mOptStackedWidget->indexOf( mOptsPage_Information ) && ! mMetadataFilled )
1912 teMetadataViewer->clear();
1913 teMetadataViewer->setHtml( htmlMetadata() );
1914 mMetadataFilled =
true;
1920 void QgsVectorLayerProperties::mSimplifyDrawingGroupBox_toggled(
bool checked )
1925 mSimplifyDrawingAtProvider->setEnabled(
false );
1929 mSimplifyDrawingAtProvider->setEnabled( checked );
1933 void QgsVectorLayerProperties::updateVariableEditor()
1936 mVariableEditor->setContext( &context );
1940 mVariableEditor->reloadContext();
1941 mVariableEditor->setEditableScopeIndex( 2 );
1944 void QgsVectorLayerProperties::showHelp()
1946 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property(
"helpPage" );
1948 if ( helpPage.isValid() )
1954 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/vector_properties.html" ) );
1958 void QgsVectorLayerProperties::updateAuxiliaryStoragePage()
1965 mAuxiliaryStorageInformationGrpBox->setEnabled(
true );
1966 mAuxiliaryStorageFieldsGrpBox->setEnabled(
true );
1973 mAuxiliaryStorageFeaturesLineEdit->setText( QLocale().toString( features ) );
1976 mAuxiliaryLayerActionClear->setEnabled(
true );
1977 mAuxiliaryLayerActionDelete->setEnabled(
true );
1978 mAuxiliaryLayerActionExport->setEnabled(
true );
1979 mAuxiliaryLayerActionNew->setEnabled(
false );
1985 mAuxiliaryStorageFieldsLineEdit->setText( QLocale().toString( fields ) );
1988 mAuxiliaryStorageFieldsTree->clear();
1992 QTreeWidgetItem *item =
new QTreeWidgetItem();
1994 item->setText( 0, prop.
origin() );
1995 item->setText( 1, prop.
name() );
1996 item->setText( 2, prop.
comment() );
2000 mAuxiliaryStorageFieldsTree->addTopLevelItem( item );
2006 mAuxiliaryStorageInformationGrpBox->setEnabled(
false );
2007 mAuxiliaryStorageFieldsGrpBox->setEnabled(
false );
2009 mAuxiliaryLayerActionClear->setEnabled(
false );
2010 mAuxiliaryLayerActionDelete->setEnabled(
false );
2011 mAuxiliaryLayerActionExport->setEnabled(
false );
2012 mAuxiliaryLayerActionNew->setEnabled(
true );
2014 mAuxiliaryStorageFieldsTree->clear();
2015 mAuxiliaryStorageKeyLineEdit->setText( QString() );
2016 mAuxiliaryStorageFieldsLineEdit->setText( QString() );
2017 mAuxiliaryStorageFeaturesLineEdit->setText( QString() );
2021 void QgsVectorLayerProperties::onAuxiliaryLayerNew()
2029 if ( dlg.exec() == QDialog::Accepted )
2031 updateAuxiliaryStoragePage();
2035 void QgsVectorLayerProperties::onAuxiliaryLayerClear()
2042 const QString msg = tr(
"Are you sure you want to clear auxiliary data for %1?" ).arg( mLayer->
name() );
2043 QMessageBox::StandardButton reply;
2044 reply = QMessageBox::question(
this,
"Clear Auxiliary Data", msg, QMessageBox::Yes | QMessageBox::No );
2046 if ( reply == QMessageBox::Yes )
2048 QApplication::setOverrideCursor( Qt::WaitCursor );
2050 QApplication::restoreOverrideCursor();
2051 updateAuxiliaryStoragePage();
2056 void QgsVectorLayerProperties::onAuxiliaryLayerDelete()
2062 const QString msg = tr(
"Are you sure you want to delete auxiliary storage for %1?" ).arg( mLayer->
name() );
2063 QMessageBox::StandardButton reply;
2064 reply = QMessageBox::question(
this,
"Delete Auxiliary Storage", msg, QMessageBox::Yes | QMessageBox::No );
2066 if ( reply == QMessageBox::Yes )
2068 QApplication::setOverrideCursor( Qt::WaitCursor );
2081 QApplication::restoreOverrideCursor();
2082 updateAuxiliaryStoragePage();
2087 void QgsVectorLayerProperties::onAuxiliaryLayerDeleteField()
2093 QList<QTreeWidgetItem *> items = mAuxiliaryStorageFieldsTree->selectedItems();
2094 if ( items.count() < 1 )
2098 const QTreeWidgetItem *item = items[0];
2101 def.
setName( item->text( 1 ) );
2111 const QString msg = tr(
"Are you sure you want to delete auxiliary field %1 for %2?" ).arg( item->text( 1 ), item->text( 0 ) );
2113 QMessageBox::StandardButton reply;
2114 const QString title = QObject::tr(
"Delete Auxiliary Field" );
2115 reply = QMessageBox::question(
this, title, msg, QMessageBox::Yes | QMessageBox::No );
2117 if ( reply == QMessageBox::Yes )
2119 QApplication::setOverrideCursor( Qt::WaitCursor );
2120 deleteAuxiliaryField( index );
2122 QApplication::restoreOverrideCursor();
2126 void QgsVectorLayerProperties::onAuxiliaryLayerAddField()
2133 if ( dlg.exec() == QDialog::Accepted )
2135 updateAuxiliaryStoragePage();
2139 void QgsVectorLayerProperties::deleteAuxiliaryField(
int index )
2152 if ( key >= 0 && def.
origin().compare(
"labeling", Qt::CaseInsensitive ) == 0
2159 updateAuxiliaryStoragePage();
2160 mSourceFieldsPropertiesDialog->
init();
2164 const QString title = QObject::tr(
"Delete Auxiliary Field" );
2166 const QString msg = QObject::tr(
"Unable to remove auxiliary field (%1)" ).arg( errors );
2167 mMessageBar->
pushMessage( title, msg, Qgis::MessageLevel::Warning );
static QString defaultProjectScales()
A string with default project scales.
void clearActions()
Removes all actions.
QUuid addAction(QgsAction::ActionType type, const QString &name, const QString &command, bool capture=false)
Add an action with the given name and action details.
Utility class that encapsulates an action based on vector attributes.
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
static QRegularExpression shortNameRegularExpression()
Returns the short name regular expression for line edit validator.
void init(const QgsActionManager &action, const QgsAttributeTableConfig &attributeTableConfig)
bool showWidgetInAttributeTable() const
QList< QgsAction > actions() const
QgsAttributeTableConfig::ActionWidgetStyle attributeTableWidgetStyle() const
This is a container for configuration of the attribute table.
@ Action
This column represents an action widget.
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Gets the list with all columns and their configuration.
void update(const QgsFields &fields)
Update the configuration with the given fields.
void setActionWidgetStyle(ActionWidgetStyle actionWidgetStyle)
Set the style of the action widget.
void setColumns(const QVector< QgsAttributeTableConfig::ColumnConfig > &columns)
Set the list of columns visible in the attribute table.
Class allowing to manage the auxiliary storage for a vector layer.
static QgsPropertyDefinition propertyDefinitionFromField(const QgsField &field)
Returns the property definition from an auxiliary field.
bool clear()
Deletes all features from the layer.
bool deleteAttribute(int attr) override
Removes attribute from the layer and commits changes.
QgsFields auxiliaryFields() const
Returns a list of all auxiliary fields currently managed by the layer.
int propertyFromIndex(int index) const
Returns the underlying property key for the field index.
QgsVectorLayerJoinInfo joinInfo() const
Returns information to use for joining with primary key and so on.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
QgsPropertyDefinition propertyDefinitionFromIndex(int index) const
Returns the property definition for the underlying field index.
static bool deleteTable(const QgsDataSourceUri &uri)
Removes a table from the auxiliary storage.
This class represents a coordinate reference system (CRS).
virtual bool supportsSubsetString() const
Returns true if the provider supports setting of subset strings.
Class for storing the component parts of a RDBMS data source URI (e.g.
void syncToLayer()
Updates the widget to reflect the layer's current diagram settings.
void auxiliaryFieldCreated()
static void setLayerVariables(QgsMapLayer *layer, const QVariantMap &variables)
Sets all layer context variables.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool forceRasterRender() const
Returns whether the renderer must render as a raster.
void setForceRasterRender(bool forceRaster)
Sets whether the renderer should be rendered to a raster destination.
double referenceScale() const
Returns the symbology reference scale.
void setReferenceScale(double scale)
Sets the symbology reference scale.
@ SpatialIndexPresent
A valid spatial index exists for the source.
virtual SpatialIndexPresence hasSpatialIndex() const
Returns an enum value representing the presence of a valid spatial index on the source,...
Encapsulate a field in an attribute table or data source.
QString typeName() const
Gets the field type.
int indexFromName(const QString &fieldName) const
Gets the field index from the field name.
int indexOf(const QString &fieldName) const
Gets the field index from the field name.
int count() const
Returns number of items.
int size() const
Returns number of items.
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
static QgsGui * instance()
Returns a pointer to the singleton instance.
static QgsNative * nativePlatformInterface()
Returns the global native interface, which offers abstraction to the host OS's underlying public inte...
static QgsSubsetStringEditorProviderRegistry * subsetStringEditorProviderRegistry()
Returns the registry of subset string editors of data providers.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
QgsLayerTreeFilterProxyModel is a sort filter proxy model to easily reproduce the legend/layer tree i...
QList< QgsMapLayer * > checkedLayers() const
Returns the checked layers.
void setLayerTreeModel(QgsLayerTreeModel *layerTreeModel)
Sets the layer tree model.
void setCheckedLayers(const QList< QgsMapLayer * > layers)
Initialize the list of checked layers.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
Map canvas is a class for displaying all GIS data types on a canvas.
double scale() const
Returns the last reported scale of the canvas.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
This class models dependencies with or between map layers.
A reusable dialog which allows users to select stored layer styles and categories to load for a map l...
Manages QGIS Server properties for a map layer.
void removesExtraMenuSeparators(QMenu *m)
removes extra separators from the menu
void addStyleManagerActions(QMenu *m, QgsMapLayer *layer)
adds actions to the menu in accordance to the layer
static QgsMapLayerStyleGuiUtils * instance()
returns a singleton instance of this class
QString currentStyle() const
Returns name of the current style.
QStringList styles() const
Returns list of all defined style names.
bool setCurrentStyle(const QString &name)
Set a different style as the current style - will apply it to the layer.
bool isDefault(const QString &styleName) const
Returns true if this is the default style.
QgsMapLayerStyle style(const QString &name) const
Returns data of a stored style - accessed by its unique name.
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
QString xmlData() const
Returns XML content of the style.
Base class for all map layer types.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
void setRefreshOnNotifyEnabled(bool enabled)
Set whether provider notification is connected to triggerRepaint.
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Import the properties of this layer from a QDomDocument.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
virtual QString saveSldStyle(const QString &uri, bool &resultFlag) const
Saves the properties of this layer to an SLD format file.
QString source() const
Returns the source for the layer.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
QString providerType() const
Returns the provider type (provider key) for this layer.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
QgsCoordinateReferenceSystem crs
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
virtual QString loadNamedMetadata(const QString &uri, bool &resultFlag)
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record ...
bool hasAutoRefreshEnabled() const
Returns true if auto refresh is enabled for the layer.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setAutoRefreshEnabled(bool enabled)
Sets whether auto refresh is enabled for the layer.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsLayerMetadata metadata
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
virtual QString saveDefaultStyle(bool &resultFlag)
Save the properties of this layer as the default style (either as a .qml file on disk or as a record ...
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
virtual QString loadSldStyle(const QString &uri, bool &resultFlag)
Attempts to style the layer using the formatting from an SLD type file.
virtual QString saveDefaultMetadata(bool &resultFlag)
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as ...
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
virtual QString styleURI() const
Retrieve the style URI for this layer (either as a .qml file on disk or as a record in the users styl...
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
void setRefreshOnNofifyMessage(const QString &message)
Set the notification message that triggers repaint If refresh on notification is enabled,...
static QString extensionPropertyType(PropertyType type)
Returns the extension of a Property.
void setName(const QString &name)
Set the display name of the layer.
void setAutoRefreshInterval(int interval)
Sets the auto refresh interval (in milliseconds) for the layer.
QString saveNamedMetadata(const QString &uri, bool &resultFlag)
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a re...
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
double minimumScale() const
Returns the minimum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QString legendUrl() const
Returns the URL for the layer's legend.
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
virtual QString saveNamedStyle(const QString &uri, bool &resultFlag, StyleCategories categories=AllStyleCategories)
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in t...
virtual QString metadataUri() const
Retrieve the metadata URI for this layer (either as a .qmd file on disk or as a record in the users s...
double maximumScale() const
Returns the maximum map scale (i.e.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
A bar for displaying non-blocking messages to the user.
void pushMessage(const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=-1)
A convenience method for pushing a message with the specified text to the bar.
A dialog to create a new auxiliary field.
A dialog to create a new auxiliary layer.
A base dialog for options and properties dialogs that offers vertical tabs.
void resizeAlltabs(int index)
Resizes all tabs when the dialog is resized.
void addPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QStringList &path=QStringList())
Adds a new page to the dialog pages.
virtual void optionsStackedWidget_CurrentChanged(int index)
Select relevant tab on current page change.
void insertPage(const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before, const QStringList &path=QStringList())
Inserts a new page into the dialog pages.
void restoreOptionsBaseUi(const QString &title=QString())
Restore the base ui.
QStackedWidget * mOptStackedWidget
void initOptionsBase(bool restoreUi=true, const QString &title=QString())
Set up the base ui connections for vertical tabs.
Property
Data definable properties.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
void setDirty(bool b=true)
Flag the project as dirty (modified).
Definition for a property.
QString comment() const
Returns the comment of the property.
void setOrigin(const QString &origin)
Sets the origin of the property.
QString name() const
Returns the name of the property.
void setName(const QString &name)
Sets the name of the property.
QString origin() const
Returns the origin of the property.
void setComment(const QString &comment)
Sets comment of the property.
void showPanel(QgsPanelWidget *panel)
Emit when you require a panel to be show in the interface.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the dialog is shown, e.g., the associated map canvas and expression context...
void apply()
Apply the changes from the dialog to the layer.
void layerVariablesChanged()
Emitted when expression context variables on the associated vector layers have been changed.
void widgetChanged()
Emitted when something on the widget has changed.
void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
static QMap< int, QString > wmsDimensionDefaultDisplayLabels()
Returns WMS Dimension default display labels.
bool addWmsDimension(const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo)
Adds a QGIS Server WMS Dimension.
bool removeWmsDimension(const QString &wmsDimName)
Removes a QGIS Server WMS Dimension.
const QList< QgsServerWmsDimensionProperties::WmsDimensionInfo > wmsDimensions() const
Returns the QGIS Server WMS Dimension list.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static QgsStyle * defaultStyle()
Returns default application-wide style.
Interface for a dialog that can edit subset strings.
virtual QString subsetString() const =0
Returns the subset string entered in the dialog.
virtual void setSubsetString(const QString &subsetString)=0
Sets a subset string into the dialog.
QgsSubsetStringEditorInterface * createDialog(QgsVectorLayer *layer, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Creates a new dialog to edit the subset string of the provided layer.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
This is the base class for vector data providers.
static QStringList availableEncodings()
Returns a list of available encodings.
@ SimplifyGeometries
Supports simplification of geometries on provider side according to a distance tolerance.
@ SelectEncoding
Allows user to select encoding.
@ CreateSpatialIndex
Allows creation of spatial index.
virtual bool isSaveAndLoadStyleToDatabaseSupported() const
It returns false by default.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
virtual bool createAttributeIndex(int field)
Create an attribute index on the datasource.
QString encoding() const
Returns the encoding which is used for accessing data.
virtual Q_INVOKABLE QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
Defines left outer join from our vector layer to some other vector layer.
bool hasCascadedDelete() const
Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the ...
bool isDynamicFormEnabled() const
Returns whether the form has to be dynamically updated with joined fields when a feature is being cre...
bool hasUpsertOnEdit() const
Returns whether a feature created on the target layer has to impact the joined layer by creating a ne...
bool isEditable() const
Returns whether joined fields may be edited through the form of the target layer.
bool isUsingMemoryCache() const
Returns whether values from the joined layer should be cached in memory to speed up lookups.
QString prefix() const
Returns prefix of fields from the joined layer. If nullptr, joined layer's name will be used.
static QStringList joinFieldNamesSubset(const QgsVectorLayerJoinInfo &info, bool blocklisted=true)
Returns the list of field names to use for joining considering blocklisted fields and subset.
QString joinFieldName() const
Returns name of the field of joined layer that will be used for join.
QString targetFieldName() const
Returns name of the field of our layer that will be used for join.
QString joinLayerId() const
ID of the joined layer - may be used to resolve reference to the joined layer.
QgsVectorLayer * joinLayer() const
Returns joined layer (may be nullptr if the reference was set by layer ID and not resolved yet)
QgsVectorLayerProperties(QgsMapCanvas *canvas, QgsMessageBar *messageBar, QgsVectorLayer *lyr=nullptr, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
void optionsStackedWidget_CurrentChanged(int index) override
void addPropertiesPageFactory(const QgsMapLayerConfigWidgetFactory *factory)
Adds a properties page factory to the vector layer properties dialog.
void toggleEditing(QgsMapLayer *)
void exportAuxiliaryLayer(QgsAuxiliaryLayer *layer)
The QgsVectorLayerSaveStyleDialog class provides the UI to save the current style or multiple styles ...
Represents a vector layer which manages a vector based data sets.
void setAuxiliaryLayer(QgsAuxiliaryLayer *layer=nullptr)
Sets the current auxiliary layer.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
bool addJoin(const QgsVectorLayerJoinInfo &joinInfo)
Joins another vector layer to this layer.
QSet< QgsMapLayerDependency > dependencies() const FINAL
Gets the list of dependencies.
long long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
virtual int listStylesInDatabase(QStringList &ids, QStringList &names, QStringList &descriptions, QString &msgError)
Lists all the style in db split into related to the layer and not related to.
void updateFields()
Will regenerate the fields property of this layer by obtaining all fields from the dataProvider,...
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
virtual QString loadNamedStyle(const QString &theURI, bool &resultFlag, bool loadFromLocalDb, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Loads a named style from file/local db/datasource db.
QString htmlMetadata() const FINAL
Obtain a formatted HTML string containing assorted metadata for this layer.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Sets the simplification settings for fast rendering of features.
void setMapTipTemplate(const QString &mapTipTemplate)
The mapTip is a pretty, html representation for feature information.
virtual QString getStyleFromDatabase(const QString &styleId, QString &msgError)
Returns the named style corresponding to style id provided.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
bool setDependencies(const QSet< QgsMapLayerDependency > &layers) FINAL
Sets the list of dependencies.
void setProviderEncoding(const QString &encoding)
Sets the text encoding of the data provider.
void setDisplayExpression(const QString &displayExpression)
Set the preview expression, used to create a human readable preview string.
bool removeJoin(const QString &joinLayerId)
Removes a vector layer join.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
QStringList commitErrors() const
Returns a list containing any error messages generated when attempting to commit changes to the layer...
virtual void saveStyleToDatabase(const QString &name, const QString &description, bool useAsDefault, const QString &uiFileContent, QString &msgError)
Saves named and sld style of the layer to the style table in the db.
virtual void updateExtents(bool force=false)
Update the extents for the layer.
QgsActionManager * actions()
Returns all layer actions defined on this layer.
QString displayExpression
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
QgsAttributeTableConfig attributeTableConfig() const
Returns the attribute table configuration object.
void setAttributeTableConfig(const QgsAttributeTableConfig &attributeTableConfig)
Sets the attribute table configuration object.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
const QList< QgsVectorLayerJoinInfo > vectorJoins() const
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
This class contains information how to simplify geometries fetched from a vector layer.
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported,...
void setSimplifyHints(SimplifyHints simplifyHints)
Sets the simplification hints of the vector layer managed.
float maximumScale() const
Gets the maximum scale at which the layer should be simplified.
void setThreshold(float threshold)
Sets the simplification threshold of the vector layer managed.
void setSimplifyAlgorithm(SimplifyAlgorithm simplifyAlgorithm)
Sets the local simplification algorithm of the vector layer managed.
void setForceLocalOptimization(bool localOptimization)
Sets where the simplification executes, after fetch the geometries from provider, or when supported,...
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
SimplifyAlgorithm simplifyAlgorithm() const
Gets the local simplification algorithm of the vector layer managed.
float threshold() const
Gets the simplification threshold of the vector layer managed.
@ GeometrySimplification
The geometries can be simplified using the current map2pixel context state.
@ AntialiasingSimplification
The geometries can be rendered with 'AntiAliasing' disabled because of it is '1-pixel size'.
@ NoSimplification
No simplification can be applied.
SimplifyAlgorithm
Types of local simplification algorithms that can be used.
@ Distance
The simplification uses the distance between points to remove duplicate points.
@ SnapToGrid
The simplification uses a grid (similar to ST_SnapToGrid) to remove duplicate points.
@ Visvalingam
The simplification gives each point in a line an importance weighting, so that least important points...
void setMaximumScale(float maximumScale)
Sets the maximum scale at which the layer should be simplified.
The QgsWmsDimensionDialog class provides an interface for WMS/OAPIF (WFS3) dimensions configuration A...
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.
Setting to define QGIS Server WMS Dimension.