Skip to content

Commit

Permalink
use filter proxy in the widget
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 19, 2021
1 parent aa23d00 commit d941b52
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/symbology/qgssvgselectorwidget.cpp
Expand Up @@ -491,8 +491,9 @@ void QgsSvgSelectorWidget::populateIcons( const QModelIndex &idx )
QString path = idx.data( Qt::UserRole + 1 ).toString();

QAbstractItemModel *oldModel = mImagesListView->model();
QgsSvgSelectorListModel *m = new QgsSvgSelectorListModel( mImagesListView, path, mIconSize );
QgsSvgSelectorFilterModel *m = new QgsSvgSelectorFilterModel( mImagesListView, path, mIconSize );
mImagesListView->setModel( m );
connect( mSvgFilterLineEdit, &QgsFilterLineEdit::textChanged, m, &QSortFilterProxyModel::setFilterFixedString );
delete oldModel; //explicitly delete old model to force any background threads to stop

connect( mImagesListView->selectionModel(), &QItemSelectionModel::currentChanged,
Expand Down Expand Up @@ -520,8 +521,9 @@ void QgsSvgSelectorWidget::populateList()

// Initially load the icons in the List view without any grouping
QAbstractItemModel *oldModel = mImagesListView->model();
QgsSvgSelectorListModel *m = new QgsSvgSelectorListModel( mImagesListView );
QgsSvgSelectorFilterModel *m = new QgsSvgSelectorFilterModel( mImagesListView );
mImagesListView->setModel( m );
connect( mSvgFilterLineEdit, &QgsFilterLineEdit::textChanged, m, &QSortFilterProxyModel::setFilterFixedString );
delete oldModel; //explicitly delete old model to force any background threads to stop
}

Expand Down

0 comments on commit d941b52

Please sign in to comment.