Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix deprecated toSet
  • Loading branch information
elpaso committed Feb 27, 2021
1 parent 0470b5f commit 6c0f03c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/core/layout/qgslayoutitemattributetable.cpp
Expand Up @@ -726,14 +726,20 @@ QgsLayoutTableColumns QgsLayoutItemAttributeTable::filteredColumns()

if ( mLayout->renderContext().featureFilterProvider() )
{
QSet<QString> filteredAttributes = layout()->renderContext().featureFilterProvider()->layerAttributes( source, QStringList::fromSet( allowedAttributes ) ).toSet();
if ( filteredAttributes != allowedAttributes )
const QStringList filteredAttributes { layout()->renderContext().featureFilterProvider()->layerAttributes( source, allowedAttributes.values() ) };
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
const QSet<QString> filteredAttributesSet( filteredAttributes.constBegin(), filteredAttributes.constEnd() );
#else
const QSet<QString> filteredAttributesSet { filteredAttributes.toSet() };
#endif
if ( filteredAttributesSet != allowedAttributes )
{
const auto forbidden { allowedAttributes.subtract( filteredAttributes ) };
allowedColumns.erase( std::remove_if( allowedColumns.begin(), allowedColumns.end(), [ &forbidden ]( QgsLayoutTableColumn & c )
const auto forbidden { allowedAttributes.subtract( filteredAttributesSet ) };
allowedColumns.erase( std::remove_if( allowedColumns.begin(), allowedColumns.end(), [ &forbidden ]( QgsLayoutTableColumn & c ) -> bool
{
return forbidden.contains( c.attribute() );
} ), allowedColumns.end() );

}
}

Expand Down

0 comments on commit 6c0f03c

Please sign in to comment.