LocaleFilterModel Class

The LocaleFilterModel class provides a filtered model for the available locales. More...

Header: #include <LocaleFilterModel>
qmake: QT += localesettings
Inherits: QSortFilterProxyModel

Properties

Public Functions

LocaleFilterModel(QObject *parent)
virtual ~LocaleFilterModel()
QString filter() const
int indexForCountry(const QString &country) const
QVariant itemFromRow(const int row) const
void setFilter(const QString &aFilter)

Reimplemented Public Functions

virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override

Signals

void filterChanged()

Detailed Description

This class can be used as the model in a view that lists the available locales.

See also LocaleModel.

Property Documentation

filter : QString

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.

Access functions:

QString filter() const
void setFilter(const QString &aFilter)

Notifier signal:

void filterChanged()

See also LocaleItem::country.

Member Function Documentation

LocaleFilterModel::LocaleFilterModel(QObject *parent)

Creates a locale filer model with the parent parent.

[virtual] LocaleFilterModel::~LocaleFilterModel()

Deletes the locale filter model.

QString LocaleFilterModel::filter() const

Returns the locale filter string.

Note: Getter function for property filter.

See also setFilter().

[override virtual] bool LocaleFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const

Reimplements: QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const.

Returns whether the row source_row has the country role and whether it is found in the locale model source_parent.

int LocaleFilterModel::indexForCountry(const QString &country) const

Returns the index for the country country in the locale filter model.

The index is used by item views, delegates, and selection models to locate an item in the model.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

QVariant LocaleFilterModel::itemFromRow(const int row) const

Returns the locale item at row in the locale filter model.

This item can be assigned to LocaleManager::locale(), when the user selects a locale from a list.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

See also LocaleItem.

void LocaleFilterModel::setFilter(const QString &aFilter)

Sets the locale filter string to aFilter.

Note: Setter function for property filter.

See also filter().

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.