Skip to content

Commit b26d9ac

Browse files
committed
add column headers and tooltips to dxf export dialog (fixes #13138)
1 parent 6b25fe5 commit b26d9ac

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/app/qgsdxfexportdialog.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ int QgsVectorLayerAndAttributeModel::attributeIndex( const QgsVectorLayer *vl )
132132
return mAttributeIdx.value( vl, -1 );
133133
}
134134

135+
QVariant QgsVectorLayerAndAttributeModel::headerData( int section, Qt::Orientation orientation, int role ) const
136+
{
137+
if ( orientation == Qt::Horizontal )
138+
{
139+
if ( role == Qt::DisplayRole )
140+
{
141+
if ( section == 0 )
142+
return tr( "Layer" );
143+
else if ( section == 1 )
144+
return tr( "Output layer attribute" );
145+
}
146+
else if ( role == Qt::ToolTipRole )
147+
{
148+
if ( section == 1 )
149+
return tr( "Attribute containing the name of the destination layer in the DXF output." );
150+
}
151+
}
152+
return QVariant();
153+
}
154+
135155
QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex& idx, int role ) const
136156
{
137157
if ( idx.column() == 0 )
@@ -200,6 +220,11 @@ QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex& idx, int role
200220
else
201221
return vl->name();
202222
}
223+
224+
if ( role == Qt::ToolTipRole )
225+
{
226+
return tr( "Attribute containing the name of the destination layer in the DXF output." );
227+
}
203228
}
204229

205230
return QVariant();
@@ -389,6 +414,7 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
389414
model->setFlags( 0 );
390415
mTreeView->setModel( model );
391416
mTreeView->resizeColumnToContents( 0 );
417+
mTreeView->header()->show();
392418

393419
connect( mFileLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( setOkEnabled() ) );
394420
connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) );

src/app/qgsdxfexportdialog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class QgsVectorLayerAndAttributeModel : public QgsLayerTreeModel
4949
~QgsVectorLayerAndAttributeModel();
5050

5151
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
52+
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
5253
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
5354
Qt::ItemFlags flags( const QModelIndex &index ) const override;
5455
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
@@ -88,7 +89,7 @@ class QgsDxfExportDialog : public QDialog, private Ui::QgsDxfExportDialogBase
8889
QString encoding() const;
8990

9091
public slots:
91-
/** change the selection of layers in the list */
92+
/** Change the selection of layers in the list */
9293
void selectAll();
9394
void unSelectAll();
9495

0 commit comments

Comments
 (0)