From c06813317f1030f4c16968fc523746c064d24aab Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 17 Sep 2015 18:08:24 -0300 Subject: Preferences: hook up the missing parts for the language prefs ui And this actually made me find one memory leak on the old version: We are constantly creating / leaking a new QSortFilterProxyModel everytime a sync() is done on the settings. That's not a lot, maybe once per time a user changes its settings... but it's still a leak. And the code is more sanely separated this time. yey. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences/preferences_language.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'desktop-widgets') diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 7254482e2..f9cd1da93 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -4,12 +4,23 @@ #include #include #include +#include +#include "qt-models/models.h" PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Language"), QIcon(":/language"), 4) { ui = new Ui::PreferencesLanguage(); ui->setupUi(this); + + QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(); + filterModel->setSourceModel(LanguageModel::instance()); + filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); + ui->languageView->setModel(filterModel); + filterModel->sort(0); + connect(ui->languageFilter, &QLineEdit::textChanged, + filterModel, &QSortFilterProxyModel::setFilterFixedString); + } PreferencesLanguage::~PreferencesLanguage() -- cgit v1.2.3-70-g09d2