From b26d9ac865b7065cd6418478a9b7c5db941cdc95 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Thu, 23 Jul 2015 14:06:58 +0200 Subject: [PATCH] add column headers and tooltips to dxf export dialog (fixes #13138) --- src/app/qgsdxfexportdialog.cpp | 26 ++++++++++++++++++++++++++ src/app/qgsdxfexportdialog.h | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/app/qgsdxfexportdialog.cpp b/src/app/qgsdxfexportdialog.cpp index c3dd0436522..5a10dadfe89 100644 --- a/src/app/qgsdxfexportdialog.cpp +++ b/src/app/qgsdxfexportdialog.cpp @@ -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() ) ); diff --git a/src/app/qgsdxfexportdialog.h b/src/app/qgsdxfexportdialog.h index 0ea5a23a18f..594e1860a10 100644 --- a/src/app/qgsdxfexportdialog.h +++ b/src/app/qgsdxfexportdialog.h @@ -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();