Skip to content
Permalink
Browse files

use filter proxy in the widget

  • Loading branch information
3nids committed Mar 19, 2021
1 parent aa23d00 commit d941b5216e13f3b49e58c4819358e16afd0477ee
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/gui/symbology/qgssvgselectorwidget.cpp
@@ -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,
@@ -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
}

0 comments on commit d941b52

Please sign in to comment.