Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Browser proxy model: hide layer operations if layer filter is set
This is to avoid layer operations to be shown when
selecting data source
  • Loading branch information
elpaso committed Jul 11, 2020
1 parent 462ce2f commit 6590d69
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/qgsbrowserproxymodel.cpp
Expand Up @@ -289,17 +289,24 @@ void QgsBrowserProxyModel::setShownDataItemProviderKeyFilter( const QStringList
{
mShownDataItemsKeys = filter;
invalidateFilter();

}


bool QgsBrowserProxyModel::hasChildren( const QModelIndex &parent ) const
{
bool isFertile { QSortFilterProxyModel::hasChildren( parent ) };
if ( isFertile && ! mShowLayers && parent.isValid() )
if ( isFertile && parent.isValid() )
{
QgsDataItem *item = dataItem( parent );
return ! item->layerCollection();
if ( ! mShowLayers )
{
return ! item->layerCollection();
}
// Hide everything below layers if filter is set
else if ( mFilterByLayerType && qobject_cast< QgsLayerItem * >( item ) )
{
return false;
}
}
return isFertile;
}

0 comments on commit 6590d69

Please sign in to comment.