Skip to content
Permalink
Browse files

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 6590d69a2f0286b4cbe80bc784f5eab692f7b11a
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/core/qgsbrowserproxymodel.cpp
@@ -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.
You can’t perform that action at this time.