Skip to content

Commit

Permalink
Fix layer id sorting in ArcGIS rest source select dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 9, 2018
1 parent 75d88af commit 8bb297d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/providers/arcgisrest/qgsafssourceselect.cpp
Expand Up @@ -62,6 +62,13 @@ bool QgsAfsSourceSelect::connectToService( const QgsOwsConnection &connection )
}
// insert the typenames, titles and abstracts into the tree view
QStandardItem *idItem = new QStandardItem( layerData[QStringLiteral( "id" )].toString() );
bool ok = false;
int idInt = layerData[QStringLiteral( "id" )].toInt( &ok );
if ( ok )
{
// force display role to be int value, so that sorting works correctly
idItem->setData( idInt, Qt::DisplayRole );
}
QStandardItem *nameItem = new QStandardItem( layerData[QStringLiteral( "name" )].toString() );
QStandardItem *abstractItem = new QStandardItem( layerData[QStringLiteral( "description" )].toString() );
abstractItem->setToolTip( layerData[QStringLiteral( "description" )].toString() );
Expand Down
7 changes: 7 additions & 0 deletions src/providers/arcgisrest/qgsamssourceselect.cpp
Expand Up @@ -64,6 +64,13 @@ bool QgsAmsSourceSelect::connectToService( const QgsOwsConnection &connection )
}
// insert the typenames, titles and abstracts into the tree view
QStandardItem *idItem = new QStandardItem( layerData[QStringLiteral( "id" )].toString() );
bool ok = false;
int idInt = layerData[QStringLiteral( "id" )].toInt( &ok );
if ( ok )
{
// force display role to be int value, so that sorting works correctly
idItem->setData( idInt, Qt::DisplayRole );
}
QStandardItem *nameItem = new QStandardItem( layerData[QStringLiteral( "name" )].toString() );
QStandardItem *abstractItem = new QStandardItem( layerData[QStringLiteral( "description" )].toString() );
abstractItem->setToolTip( layerData[QStringLiteral( "description" )].toString() );
Expand Down

0 comments on commit 8bb297d

Please sign in to comment.