diff options
author | Mikko Gronoff <mikko.gronoff@qt.io> | 2018-10-15 15:07:42 +0300 |
---|---|---|
committer | Mikko Gronoff <mikko.gronoff@qt.io> | 2018-10-15 15:08:26 +0300 |
commit | 9ad08f17c3cd96bb6b9d5d501870cb3987ed9097 (patch) | |
tree | e84ab2f923e202f3021e8a9f4d227fef195dfaf9 /src/localesettings/localefiltermodel.cpp | |
parent | 59405866644db41b866bdb561fe8ad2a1892f73b (diff) | |
parent | 261e4c619214af5e5cf95ec08a7d46d702ae0a93 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
* origin/5.11:
261e4c6 Doc: Add documentation for C++ classes
0ecd391 Fix ip address tracking and display
Commit 0ecd391 originally cherry-picked from 5.12 branch, hence
few bogus conflicts in qnetworksettingsmanager.cpp.
Conflicts:
src/networksettings/qnetworksettingsinterfacemodel.cpp
src/networksettings/qnetworksettingsmanager.cpp
Change-Id: Ib8007ffc55ba935da42209303f637b51bad3ab1d
Diffstat (limited to 'src/localesettings/localefiltermodel.cpp')
-rw-r--r-- | src/localesettings/localefiltermodel.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/localesettings/localefiltermodel.cpp b/src/localesettings/localefiltermodel.cpp index 997a316..3a5d892 100644 --- a/src/localesettings/localefiltermodel.cpp +++ b/src/localesettings/localefiltermodel.cpp @@ -31,6 +31,33 @@ QT_BEGIN_NAMESPACE +/*! + \class LocaleFilterModel + \inmodule QtDeviceUtilities + + \brief The LocaleFilterModel class provides a filtered model for the + available locales. + + This class can be used as the model in a view that lists the available + locales. + + \sa LocaleModel +*/ + +/*! + \property LocaleFilterModel::filter + \brief Holds a string that filters out the locales in the model. + + The filtering process is a case-insensitive matching for whether the region + (country) name contains this string. The string can be taken from user + input. + + \sa LocaleItem::country +*/ + +/*! + Creates a locale filer model with the parent \a parent. +*/ LocaleFilterModel::LocaleFilterModel(QObject* parent) :QSortFilterProxyModel(parent) { @@ -39,22 +66,35 @@ LocaleFilterModel::LocaleFilterModel(QObject* parent) setSourceModel(localeModel); } +/*! + Deletes the locale filter model. +*/ LocaleFilterModel::~LocaleFilterModel() { } +/*! + Returns the locale filter string. +*/ QString LocaleFilterModel::filter() const { return m_filter; } +/*! + Sets the locale filter string to \a aFilter. +*/ void LocaleFilterModel::setFilter(const QString& aFilter) { m_filter = aFilter; emit filterChanged(); } +/*! + Returns whether the row \a source_row has the country role and whether it is + found in the locale model \a source_parent. +*/ bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const { bool ret = false; @@ -76,6 +116,14 @@ bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& sou return ret; } +/*! + Returns the locale item at \a row in the locale filter model. + + This item can be assigned to LocaleManager::locale(), when the user selects + a locale from a list. + + \sa LocaleItem +*/ QVariant LocaleFilterModel::itemFromRow(const int row) const { QModelIndex idx = index(row, 0); @@ -91,6 +139,12 @@ QVariant LocaleFilterModel::itemFromRow(const int row) const return QVariant(); } +/*! + Returns the index for the country \a country in the locale filter model. + + The index is used by item views, delegates, and selection models to locate + an item in the model. +*/ int LocaleFilterModel::indexForCountry(const QString &country) const { QAbstractItemModel *model = this->sourceModel(); |