use new settings API in DXF export (#56852)

This commit is contained in:
Denis Rouzaud 2024-03-18 08:57:48 +01:00 committed by GitHub
parent 9a2d8ad8bd
commit 71583dbc0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -142,7 +142,6 @@ QgsVectorLayerAndAttributeModel::QgsVectorLayerAndAttributeModel( QgsLayerTree *
: QgsLayerTreeModel( rootNode, parent )
{
//init mCreateDDBlockInfo, mDDBlocksMaxNumberOfClasses
bool ddBlockDefaultEnabled = QgsSettings().value( QStringLiteral( "/qgis/dxfEnableDDBlocks" ), false ).toBool();
QSet<QString> 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;
}
}

View File

@ -22,6 +22,8 @@
#include "qgslayertreemodel.h"
#include "qgslayertreeview.h"
#include "qgsdxfexport.h"
#include "qgssettingstree.h"
#include "qgssettingsentryimpl.h"
#include <QList>
#include <QPair>
@ -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;