Skip to content
Permalink
Browse files

Use tooltips in identify results dialog for values

Makes it possible to see full value even when columns are too
narrow to display the value
  • Loading branch information
nyalldawson committed Sep 9, 2016
1 parent f52a9a0 commit 5e2a25119cd6a1010a7daaef2c3dc0aa661fce35
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/app/qgsidentifyresultsdialog.cpp
@@ -494,13 +494,15 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
featItem->addChild( attrItem );

attrItem->setData( 0, Qt::DisplayRole, vlayer->attributeDisplayName( i ) );
attrItem->setToolTip( 0, vlayer->attributeDisplayName( i ) );
attrItem->setData( 0, Qt::UserRole, fields.at( i ).name() );
attrItem->setData( 0, Qt::UserRole + 1, i );

attrItem->setData( 1, Qt::UserRole, value );

value = representValue( vlayer, setup, fields.at( i ).name(), attrs.at( i ) );
attrItem->setSortData( 1, value );
attrItem->setToolTip( 1, value );
bool foundLinks = false;
QString links = QgsStringUtils::insertLinks( value, &foundLinks );
if ( foundLinks )
@@ -519,7 +521,9 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
if ( fields.at( i ).name() == vlayer->displayField() )
{
featItem->setText( 0, attrItem->text( 0 ) );
featItem->setToolTip( 0, attrItem->text( 0 ) );
featItem->setText( 1, attrItem->text( 1 ) );
featItem->setToolTip( 1, attrItem->text( 1 ) );
featureLabeled = true;
}
}
@@ -533,7 +537,9 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
<< QgsExpressionContextUtils::layerScope( vlayer );
context.setFeature( f );

featItem->setText( 1, QgsExpression( vlayer->displayExpression() ).evaluate( &context ).toString() );
QString value = QgsExpression( vlayer->displayExpression() ).evaluate( &context ).toString();
featItem->setText( 1, value );
featItem->setToolTip( 1, value );
}

// table
@@ -1508,6 +1514,7 @@ void QgsIdentifyResultsDialog::attributeValueChanged( QgsFeatureId fid, int idx,

QgsTreeWidgetItem* treeItem = static_cast< QgsTreeWidgetItem* >( item );
treeItem->setSortData( 1, value );
treeItem->setToolTip( 1, value );

bool foundLinks = false;
QString links = QgsStringUtils::insertLinks( value, &foundLinks );

0 comments on commit 5e2a251

Please sign in to comment.
You can’t perform that action at this time.