Skip to content
Permalink
Browse files
Fix style manager export "select by tag" only selects some style
entity types
  • Loading branch information
nyalldawson authored and github-actions committed Nov 18, 2021
1 parent ded9c31 commit 0735975c0b8a734223c7ba1770a48b40e288052a
Showing with 34 additions and 8 deletions.
  1. +34 −8 src/gui/symbology/qgsstyleexportimportdialog.cpp
@@ -263,14 +263,27 @@ void QgsStyleExportImportDialog::clearSelection()

void QgsStyleExportImportDialog::selectFavorites()
{
const QStringList symbolNames = mStyle->symbolsOfFavorite( QgsStyle::SymbolEntity );
selectSymbols( symbolNames );
for ( int row = 0; row < listItems->model()->rowCount(); ++row )
{
const QModelIndex index = listItems->model()->index( row, 0 );
if ( index.data( QgsStyleModel::IsFavoriteRole ).toBool() )
{
listItems->selectionModel()->select( index, QItemSelectionModel::Select );
}
}
}

void QgsStyleExportImportDialog::deselectFavorites()
{
const QStringList symbolNames = mStyle->symbolsOfFavorite( QgsStyle::SymbolEntity );
deselectSymbols( symbolNames );
for ( int row = 0; row < listItems->model()->rowCount(); ++row )
{
const QModelIndex index = listItems->model()->index( row, 0 );
if ( index.data( QgsStyleModel::IsFavoriteRole ).toBool() )
{
const QItemSelection deselection( index, index );
listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
}
}
}

void QgsStyleExportImportDialog::selectSymbols( const QStringList &symbolNames )
@@ -304,14 +317,27 @@ void QgsStyleExportImportDialog::deselectSymbols( const QStringList &symbolNames

void QgsStyleExportImportDialog::selectTag( const QString &tagName )
{
const QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
selectSymbols( symbolNames );
for ( int row = 0; row < listItems->model()->rowCount(); ++row )
{
const QModelIndex index = listItems->model()->index( row, 0 );
if ( index.data( QgsStyleModel::TagRole ).toStringList().contains( tagName, Qt::CaseInsensitive ) )
{
listItems->selectionModel()->select( index, QItemSelectionModel::Select );
}
}
}

void QgsStyleExportImportDialog::deselectTag( const QString &tagName )
{
const QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
deselectSymbols( symbolNames );
for ( int row = 0; row < listItems->model()->rowCount(); ++row )
{
const QModelIndex index = listItems->model()->index( row, 0 );
if ( index.data( QgsStyleModel::TagRole ).toStringList().contains( tagName, Qt::CaseInsensitive ) )
{
const QItemSelection deselection( index, index );
listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
}
}
}

void QgsStyleExportImportDialog::selectSmartgroup( const QString &groupName )

0 comments on commit 0735975

Please sign in to comment.