fix per review from @nyalldawson

This commit is contained in:
Samweli 2020-01-13 07:56:48 +03:00 committed by Nyall Dawson
parent 6a52302853
commit 8146cc3c5f

View File

@ -96,7 +96,7 @@ QVector<QgsDataItem *> QgsWMSConnectionItem::createChildren()
// Attention, the name may be empty
QgsDebugMsgLevel( QString::number( layerProperty.orderId ) + ' ' + layerProperty.name + ' ' + layerProperty.title, 2 );
QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
QgsDataItem *layer;
QgsDataItem *layer = nullptr;
if ( layerProperty.name.isEmpty() )
layer = new QgsWMSLayerCollectionItem( this, layerProperty.title, mPath + '/' + pathName, capabilitiesProperty, uri, layerProperty );
@ -266,15 +266,13 @@ bool QgsWMSLayerCollectionItem::equal( const QgsDataItem *other )
{
return false;
}
const QgsWMSLayerCollectionItem *otherCollectionItem = dynamic_cast<const QgsWMSLayerCollectionItem *>( other );
const QgsWMSLayerCollectionItem *otherCollectionItem = qobject_cast<const QgsWMSLayerCollectionItem *>( other );
if ( !otherCollectionItem )
{
return false;
}
// Check if the children are not the same then they are not equal
if ( mChildren.isEmpty() & !otherCollectionItem->mChildren.isEmpty() )
return false;
if ( mChildren.size() != otherCollectionItem->mChildren.size() )
return false;