TimezoneModel Class

The TimezoneModel class provides a model for the available time zones. More...

Header: #include <timezonemodel.h>
qmake: QT += timedatesettings
Inherits: QAbstractListModel

Public Types

enum Roles { Name, Country, Id }

Public Functions

TimezoneModel(QObject *parent = Q_NULLPTR)
virtual ~TimezoneModel()
QList<TimezoneItem *> getModel() const

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
virtual QHash<int, QByteArray> roleNames() const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override


void ready()

Static Public Members

void generateModel(TimezoneModel *model)

Detailed Description

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

Member Type Documentation

enum TimezoneModel::Roles

This enum type holds information about a time zone.

TimezoneModel::NameQt::UserRole + 1Localized display name of the time zone
TimezoneModel::Country258Name of the country for the time zone
TimezoneModel::Id259IANA time zone ID

Member Function Documentation

TimezoneModel::TimezoneModel(QObject *parent = Q_NULLPTR)

Creates a new time zone model with the parent parent.

[signal] void TimezoneModel::ready()

This signal is emitted when the model is ready.

[virtual] TimezoneModel::~TimezoneModel()

Deletes the time zone model.

[override virtual] QVariant TimezoneModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

Returns the data at the index index in the model for the type of data specified by role.

[static] void TimezoneModel::generateModel(TimezoneModel *model)

Creates the time zone model model.

QList<TimezoneItem *> TimezoneModel::getModel() const

Returns the time zone model for a time zone item.

[override virtual] QHash<int, QByteArray> TimezoneModel::roleNames() const

Reimplements: QAbstractItemModel::roleNames() const.

Returns an array of the names of the roles in the model.

[override virtual] int TimezoneModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns the number of rows in the model with the parent parent.

© 2023 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.