add column headers and tooltips to dxf export dialog (fixes #13138)

This commit is contained in:
Juergen E. Fischer 2015-07-23 14:06:58 +02:00
parent 6b25fe5305
commit b26d9ac865
2 changed files with 28 additions and 1 deletions

View File

@ -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 )
@ -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();
@ -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() ) );

View File

@ -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;
@ -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();