Skip to content

Commit

Permalink
Keep filters when style is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 17, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c90be5b commit fcbd0a4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Original file line number Diff line number Diff line change
@@ -316,9 +316,6 @@ void QgsStyleManagerDialog::init()
groupTree->setModel( groupModel );
groupTree->setHeaderHidden( true );

const QModelIndexList prevIndex = groupTree->model()->match( groupTree->model()->index( 0, 0 ), Qt::UserRole + 1, sPreviousTag, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive | Qt::MatchRecursive );
groupTree->setCurrentIndex( !prevIndex.empty() ? prevIndex.at( 0 ) : groupTree->model()->index( 0, 0 ) );

connect( groupTree->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsStyleManagerDialog::groupChanged );
if ( !mReadOnly )
@@ -542,7 +539,6 @@ void QgsStyleManagerDialog::setCurrentStyle( QgsStyle *style )

QgsCheckableStyleModel *oldModel = mModel;


mStyle = style;
if ( mStyle != QgsStyle::defaultStyle() )
{
@@ -567,6 +563,7 @@ void QgsStyleManagerDialog::setCurrentStyle( QgsStyle *style )
}
mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );
mModel->addDesiredIconSize( listItems->iconSize() );
mModel->setFilterString( searchBox->text() );

listItems->setModel( mModel );
mSymbolTreeView->setModel( mModel );
@@ -578,8 +575,6 @@ void QgsStyleManagerDialog::setCurrentStyle( QgsStyle *style )
connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &QgsStyleManagerDialog::selectedSymbolsChanged );

tabItemType_currentChanged( tabItemType->currentIndex() );

if ( oldModel )
{
oldModel->deleteLater();
@@ -598,8 +593,12 @@ void QgsStyleManagerDialog::setCurrentStyle( QgsStyle *style )
mBlockStyleDatabaseChanges--;
}

populateList();
populateGroups();
const QModelIndexList prevIndex = groupTree->model()->match( groupTree->model()->index( 0, 0 ), Qt::UserRole + 1, sPreviousTag, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive | Qt::MatchRecursive );
groupTree->setCurrentIndex( !prevIndex.empty() ? prevIndex.at( 0 ) : groupTree->model()->index( 0, 0 ) );
populateList();

tabItemType_currentChanged( tabItemType->currentIndex() );

// set initial disabled state for actions requiring a selection
selectedSymbolsChanged( QItemSelection(), QItemSelection() );

0 comments on commit fcbd0a4

Please sign in to comment.