Skip to content

Commit

Permalink
Fix extra empty item added to the value map combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 19, 2024
1 parent 7f583ca commit b5d593e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/valuemapmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ QVariant ValueMapModelBase::map() const
void ValueMapModelBase::setMap( const QVariant &map )
{
mMap.clear();
// QGIS 3

const QVariantList list = map.toList();
if ( !list.empty() )
if ( !list.empty() ) // QGIS 3
{
beginInsertRows( QModelIndex(), 0, list.size() );
beginInsertRows( QModelIndex(), 0, list.size() - 1 );

for ( const QVariant &item : list )
{
Expand All @@ -55,7 +55,7 @@ void ValueMapModelBase::setMap( const QVariant &map )
const QVariantMap valueMap = map.toMap();
if ( !valueMap.empty() )
{
beginInsertRows( QModelIndex(), 0, valueMap.size() );
beginInsertRows( QModelIndex(), 0, valueMap.size() - 1 );

QMapIterator<QString, QVariant> i( valueMap );
while ( i.hasNext() )
Expand Down

0 comments on commit b5d593e

Please sign in to comment.