diff --git a/modules/time/timezonesmodel.cpp b/modules/time/timezonesmodel.cpp index 955ba94..527b2f2 100644 --- a/modules/time/timezonesmodel.cpp +++ b/modules/time/timezonesmodel.cpp @@ -1,45 +1,42 @@ /* * Copyright 2011 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "timezonesmodel.h" 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 TimeZonesModel::roleNames() const { QHash roleNames; roleNames[Qt::DisplayRole] = "display"; roleNames[Qt::UserRole+1] = "continent"; return roleNames; } QVariantHash TimeZonesModel::get(int i) const { QModelIndex idx = index(i, 0); QVariantHash hash; hash["display"] = data(idx, Qt::DisplayRole); hash["continent"] = data(idx, Qt::UserRole+1); return hash; } diff --git a/modules/time/timezonesmodel.h b/modules/time/timezonesmodel.h index 6627113..85a161f 100644 --- a/modules/time/timezonesmodel.h +++ b/modules/time/timezonesmodel.h @@ -1,41 +1,36 @@ /* * Copyright 2011 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TIMEZONESMODEL_H #define TIMEZONESMODEL_H #include class TimeZonesModel: public QStandardItemModel { Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) public: TimeZonesModel(QObject *parent=nullptr); Q_INVOKABLE QVariantHash get(int i) const; QHash roleNames() const override; - int count() const {return rowCount();} - -Q_SIGNALS: - void countChanged(); }; #endif