From 71583dbc0cd33d85d036bcccef5991bbd2e3b632 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 18 Mar 2024 08:57:48 +0100 Subject: [PATCH] use new settings API in DXF export (#56852) --- src/app/qgsdxfexportdialog.cpp | 3 +-- src/app/qgsdxfexportdialog.h | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/qgsdxfexportdialog.cpp b/src/app/qgsdxfexportdialog.cpp index 80e14e6b656..ff9f1cc5e5a 100644 --- a/src/app/qgsdxfexportdialog.cpp +++ b/src/app/qgsdxfexportdialog.cpp @@ -142,7 +142,6 @@ QgsVectorLayerAndAttributeModel::QgsVectorLayerAndAttributeModel( QgsLayerTree * : QgsLayerTreeModel( rootNode, parent ) { //init mCreateDDBlockInfo, mDDBlocksMaxNumberOfClasses - bool ddBlockDefaultEnabled = QgsSettings().value( QStringLiteral( "/qgis/dxfEnableDDBlocks" ), false ).toBool(); QSet layerIds; retrieveAllLayers( rootNode, layerIds ); for ( const auto &id : std::as_const( layerIds ) ) @@ -150,7 +149,7 @@ QgsVectorLayerAndAttributeModel::QgsVectorLayerAndAttributeModel( QgsLayerTree * const QgsVectorLayer *vLayer = qobject_cast< const QgsVectorLayer *>( QgsProject::instance()->mapLayer( id ) ); if ( vLayer ) { - mCreateDDBlockInfo[vLayer] = ddBlockDefaultEnabled; + mCreateDDBlockInfo[vLayer] = QgsDxfExportDialog::settingsDxfEnableDDBlocks->value(); mDDBlocksMaxNumberOfClasses[vLayer] = -1; } } diff --git a/src/app/qgsdxfexportdialog.h b/src/app/qgsdxfexportdialog.h index 93461a3278c..973bea2722c 100644 --- a/src/app/qgsdxfexportdialog.h +++ b/src/app/qgsdxfexportdialog.h @@ -22,6 +22,8 @@ #include "qgslayertreemodel.h" #include "qgslayertreeview.h" #include "qgsdxfexport.h" +#include "qgssettingstree.h" +#include "qgssettingsentryimpl.h" #include #include @@ -97,6 +99,9 @@ class QgsDxfExportDialog : public QDialog, private Ui::QgsDxfExportDialogBase { Q_OBJECT public: + static inline QgsSettingsTreeNode *sTreeAppDdxf = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "dxf" ) ); + static const inline QgsSettingsEntryBool *settingsDxfEnableDDBlocks = new QgsSettingsEntryBool( QStringLiteral( "enable-datadefined-blocks" ), sTreeAppDdxf, false ); + QgsDxfExportDialog( QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); ~QgsDxfExportDialog() override;