Skip to content

Commit

Permalink
add column headers and tooltips to dxf export dialog (fixes #13138)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 23, 2015
1 parent 6b25fe5 commit b26d9ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/app/qgsdxfexportdialog.cpp
Expand Up @@ -132,6 +132,26 @@ int QgsVectorLayerAndAttributeModel::attributeIndex( const QgsVectorLayer *vl )
return mAttributeIdx.value( vl, -1 );
}

QVariant QgsVectorLayerAndAttributeModel::headerData( int section, Qt::Orientation orientation, int role ) const
{
if ( orientation == Qt::Horizontal )
{
if ( role == Qt::DisplayRole )
{
if ( section == 0 )
return tr( "Layer" );
else if ( section == 1 )
return tr( "Output layer attribute" );
}
else if ( role == Qt::ToolTipRole )
{
if ( section == 1 )
return tr( "Attribute containing the name of the destination layer in the DXF output." );
}
}
return QVariant();
}

QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex& idx, int role ) const
{
if ( idx.column() == 0 )
Expand Down Expand Up @@ -200,6 +220,11 @@ QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex& idx, int role
else
return vl->name();
}

if ( role == Qt::ToolTipRole )
{
return tr( "Attribute containing the name of the destination layer in the DXF output." );
}
}

return QVariant();
Expand Down Expand Up @@ -389,6 +414,7 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
model->setFlags( 0 );
mTreeView->setModel( model );
mTreeView->resizeColumnToContents( 0 );
mTreeView->header()->show();

connect( mFileLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( setOkEnabled() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) );
Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsdxfexportdialog.h
Expand Up @@ -49,6 +49,7 @@ class QgsVectorLayerAndAttributeModel : public QgsLayerTreeModel
~QgsVectorLayerAndAttributeModel();

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

public slots:
/** change the selection of layers in the list */
/** Change the selection of layers in the list */
void selectAll();
void unSelectAll();

Expand Down

0 comments on commit b26d9ac

Please sign in to comment.