Commit 127b0a83 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳 Committed by Nicolas Fella

Time module improvements

parent 3c11f214
Pipeline #7566 passed with stage
in 9 minutes and 31 seconds
......@@ -119,7 +119,15 @@ SimpleKCM {
Kirigami.OverlaySheet {
id: timeZonePickerSheet
header: Kirigami.Heading { text: i18nc("@title:window", "Pick Timezone") }
header: ColumnLayout {
Kirigami.Heading { text: i18nc("@title:window", "Pick Timezone") }
Kirigami.SearchField {
Layout.fillWidth: true
onTextChanged: {
kcm.timeZoneFilterChanged(text)
}
}
}
footer: RowLayout {
Controls.Button {
......
......@@ -23,16 +23,18 @@
TimeZonesModel::TimeZonesModel(QObject *parent)
: QStandardItemModel(parent)
{
connect(this, &QAbstractItemModel::modelReset, this, &TimeZonesModel::countChanged);
connect(this, &QAbstractItemModel::rowsInserted, this, &TimeZonesModel::countChanged);
connect(this, &QAbstractItemModel::rowsRemoved, this, &TimeZonesModel::countChanged);
}
QHash<int, QByteArray> TimeZonesModel::roleNames() const {
QHash<int, QByteArray> roleNames;
roleNames[Qt::DisplayRole] = "display";
roleNames[Qt::UserRole+1] = "continent";
setRoleNames(roleNames);
connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged()));
return roleNames;
}
QVariantHash TimeZonesModel::get(int i) const
{
QModelIndex idx = index(i, 0);
......
......@@ -31,6 +31,7 @@ public:
TimeZonesModel(QObject *parent=nullptr);
Q_INVOKABLE QVariantHash get(int i) const;
QHash<int, QByteArray> roleNames() const override;
int count() const {return rowCount();}
Q_SIGNALS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment