Skip to content

Commit

Permalink
Add icon to layer and fields comboboxes in "map value" widget's Load …
Browse files Browse the repository at this point in the history
…field from layer dialog
  • Loading branch information
DelazJ authored and nyalldawson committed Nov 13, 2024
1 parent 3000b7f commit ec409aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/gui/qgsattributetypeloaddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "qgsvectordataprovider.h"
#include "qgsproject.h"
#include "qgsvectorlayer.h"
#include "qgsiconutils.h"

#include <QTableWidgetItem>
#include <QLineEdit>
Expand Down Expand Up @@ -70,7 +71,7 @@ void QgsAttributeTypeLoadDialog::fillLayerList()
{
QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( l );
if ( vl )
layerComboBox->addItem( vl->name(), vl->id() );
layerComboBox->addItem( QgsIconUtils::iconForLayer( vl ), vl->name(), vl->id() );
}
layerComboBox->setCurrentIndex( -1 );
layerComboBox->blockSignals( false );
Expand All @@ -88,12 +89,11 @@ void QgsAttributeTypeLoadDialog::fillComboBoxes( int layerIndex )
QgsVectorLayer *vLayer = qobject_cast<QgsVectorLayer *>( layerIndex < 0 ? nullptr : QgsProject::instance()->mapLayer( layerComboBox->itemData( layerIndex ).toString() ) );
if ( vLayer )
{
QMap<QString, int> fieldMap = vLayer->dataProvider()->fieldNameMap();
QMap<QString, int>::iterator it = fieldMap.begin();
for ( ; it != fieldMap.end(); ++it )
const QgsFields vLayerFields = vLayer->dataProvider()->fields();
for (int idx = 0; idx < vLayerFields.count(); ++idx )
{
keyComboBox->addItem( it.key(), it.value() );
valueComboBox->addItem( it.key(), it.value() );
keyComboBox->addItem( vLayerFields.iconForField( idx ), vLayerFields.at( idx ).name(), idx );
valueComboBox->addItem( vLayerFields.iconForField( idx ), vLayerFields.at( idx ).name(), idx );
}
}

Expand Down

0 comments on commit ec409aa

Please sign in to comment.