diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-17 18:08:24 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:50 -0700 |
commit | c06813317f1030f4c16968fc523746c064d24aab (patch) | |
tree | 7fa7fa0b696d96ca09e88beba633eea07fd7cc32 /desktop-widgets | |
parent | c0d16267afd66e03591a449d9fa4bff78903b203 (diff) | |
download | subsurface-c06813317f1030f4c16968fc523746c064d24aab.tar.gz |
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 <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/preferences/preferences_language.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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 <QApplication> #include <QSettings> #include <QMessageBox> +#include <QSortFilterProxyModel> +#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() |