Skip to content

Commit

Permalink
Homogenize the look of Identify Results for different LayerTypes
Browse files Browse the repository at this point in the history
The code to build the Treeview for the Identify Results is split
in four, for the four different LayerTypes (vector, raster, mesh,
vector-tile).
But although vector and vector tile showed the 'toplevel' in bold
with the layername, the others showed... layer-count and name
in normal font.
This commit changes it so if you use the identify tool in a mixed
layer environment, they look more or less the same...
  • Loading branch information
rduivenvoorde authored and nyalldawson committed Oct 20, 2020
1 parent 7b61f08 commit 537761a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -881,10 +881,12 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,

if ( !layItem )
{
layItem = new QTreeWidgetItem( QStringList() << QString::number( lstResults->topLevelItemCount() ) << layer->name() );
layItem = new QTreeWidgetItem( QStringList() << layer->name() << QString::number( lstResults->topLevelItemCount() ) );
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast<QObject *>( layer ) ) );

lstResults->addTopLevelItem( layItem );
QFont boldFont;
boldFont.setBold( true );
layItem->setFont( 0, boldFont );

QComboBox *formatCombo = new QComboBox();

Expand Down Expand Up @@ -1122,10 +1124,13 @@ void QgsIdentifyResultsDialog::addFeature( QgsMeshLayer *layer,

if ( !layItem )
{
layItem = new QTreeWidgetItem( QStringList() << QString::number( lstResults->topLevelItemCount() ) << layer->name() );
layItem = new QTreeWidgetItem( QStringList() << layer->name() << QString::number( lstResults->topLevelItemCount() ) );
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast<QObject *>( layer ) ) );

lstResults->addTopLevelItem( layItem );
QFont boldFont;
boldFont.setBold( true );
layItem->setFont( 0, boldFont );

connect( layer, &QObject::destroyed, this, &QgsIdentifyResultsDialog::layerDestroyed );
connect( layer, &QgsMapLayer::crsChanged, this, &QgsIdentifyResultsDialog::layerDestroyed );
}
Expand Down

0 comments on commit 537761a

Please sign in to comment.