From 0c735420fc31c301947592c397dc3d8507c1112e Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 2 Jun 2016 11:16:22 +1000 Subject: [PATCH] Copy displayed value rather than original value (Respects value relation configuration and other widget settings which modify the displayed value) --- src/gui/attributetable/qgsdualview.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/attributetable/qgsdualview.cpp b/src/gui/attributetable/qgsdualview.cpp index 0342c6044f3..1db05ba6b6b 100644 --- a/src/gui/attributetable/qgsdualview.cpp +++ b/src/gui/attributetable/qgsdualview.cpp @@ -387,10 +387,7 @@ void QgsDualView::copyCellContent() const if ( action && action->data().isValid() && action->data().canConvert() ) { QModelIndex index = action->data().value(); - - QgsFeature f = masterModel()->feature( index ); - int attrIndex = mMasterModel->fieldIdx( index.column() ); - QVariant var = f.attributes().at( attrIndex ); + QVariant var = masterModel()->data( index, Qt::DisplayRole ); QApplication::clipboard()->setText( var.toString() ); } }