Skip to content

Commit

Permalink
Enable dd blocks by default and remove global setting 'enable-datadef…
Browse files Browse the repository at this point in the history
…ined-blocks'
  • Loading branch information
mhugent committed Apr 9, 2024
1 parent c67e81b commit 5a23cc4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/PyQt6/core/auto_generated/dxf/qgsdxfexport.sip.in
Expand Up @@ -27,7 +27,7 @@ Exports QGIS layers to the DXF format.

struct DxfLayer
{
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = false, int ddBlocksMaxNumberOfClasses = -1 );
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = true, int ddBlocksMaxNumberOfClasses = -1 );

QgsVectorLayer *layer() const;
%Docstring
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/dxf/qgsdxfexport.sip.in
Expand Up @@ -27,7 +27,7 @@ Exports QGIS layers to the DXF format.

struct DxfLayer
{
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = false, int ddBlocksMaxNumberOfClasses = -1 );
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = true, int ddBlocksMaxNumberOfClasses = -1 );

QgsVectorLayer *layer() const;
%Docstring
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsdxfexportdialog.cpp
Expand Up @@ -150,7 +150,7 @@ QgsVectorLayerAndAttributeModel::QgsVectorLayerAndAttributeModel( QgsLayerTree *
const QgsVectorLayer *vLayer = qobject_cast< const QgsVectorLayer *>( QgsProject::instance()->mapLayer( id ) );
if ( vLayer )
{
mCreateDDBlockInfo[vLayer] = QgsDxfExportDialog::settingsDxfEnableDDBlocks->value();
mCreateDDBlockInfo[vLayer] = true;
mDDBlocksMaxNumberOfClasses[vLayer] = -1;
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex &idx, int role
return QVariant();
}

bool checked = mCreateDDBlockInfo.contains( vl ) ? mCreateDDBlockInfo[vl] : false;
bool checked = mCreateDDBlockInfo.contains( vl ) ? mCreateDDBlockInfo[vl] : true;
if ( role == Qt::CheckStateRole )
{
return checked ? Qt::Checked : Qt::Unchecked;
Expand Down Expand Up @@ -423,7 +423,7 @@ QList< QgsDxfExport::DxfLayer > QgsVectorLayerAndAttributeModel::layers() const
if ( !layerIdx.contains( vl->id() ) )
{
layerIdx.insert( vl->id(), layers.size() );
layers << QgsDxfExport::DxfLayer( vl, mAttributeIdx.value( vl, -1 ), mCreateDDBlockInfo.value( vl, false ), mDDBlocksMaxNumberOfClasses.value( vl, -1 ) );
layers << QgsDxfExport::DxfLayer( vl, mAttributeIdx.value( vl, -1 ), mCreateDDBlockInfo.value( vl, true ), mDDBlocksMaxNumberOfClasses.value( vl, -1 ) );
}
}
}
Expand All @@ -434,7 +434,7 @@ QList< QgsDxfExport::DxfLayer > QgsVectorLayerAndAttributeModel::layers() const
if ( !layerIdx.contains( vl->id() ) )
{
layerIdx.insert( vl->id(), layers.size() );
layers << QgsDxfExport::DxfLayer( vl, mAttributeIdx.value( vl, -1 ), mCreateDDBlockInfo.value( vl, false ), mDDBlocksMaxNumberOfClasses.value( vl, -1 ) );
layers << QgsDxfExport::DxfLayer( vl, mAttributeIdx.value( vl, -1 ), mCreateDDBlockInfo.value( vl, true ), mDDBlocksMaxNumberOfClasses.value( vl, -1 ) );
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsdxfexportdialog.h
Expand Up @@ -103,7 +103,6 @@ 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 );
static const inline QgsSettingsEntryString *settingsDxfLastSettingsDir = new QgsSettingsEntryString( QStringLiteral( "last-settings-dir" ), sTreeAppDdxf, QDir::homePath() );

QgsDxfExportDialog( QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
Expand Down
2 changes: 1 addition & 1 deletion src/core/dxf/qgsdxfexport.h
Expand Up @@ -73,7 +73,7 @@ class CORE_EXPORT QgsDxfExport : public QgsLabelSink
*/
struct CORE_EXPORT DxfLayer
{
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = false, int ddBlocksMaxNumberOfClasses = -1 )
DxfLayer( QgsVectorLayer *vl, int layerOutputAttributeIndex = -1, bool buildDDBlocks = true, int ddBlocksMaxNumberOfClasses = -1 )
: mLayer( vl )
, mLayerOutputAttributeIndex( layerOutputAttributeIndex )
, mBuildDDBlocks( buildDDBlocks )
Expand Down

0 comments on commit 5a23cc4

Please sign in to comment.