Changeset View
Changeset View
Standalone View
Standalone View
applets/weather/plugin/abstractunitlistmodel.h
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #ifndef ABSTRACTUNITLISTMODEL_H | 18 | #ifndef ABSTRACTUNITLISTMODEL_H | ||
19 | #define ABSTRACTUNITLISTMODEL_H | 19 | #define ABSTRACTUNITLISTMODEL_H | ||
20 | 20 | | |||
21 | #include "util.h" | ||||
22 | | ||||
21 | #include <KUnitConversion/Unit> | 23 | #include <KUnitConversion/Unit> | ||
22 | 24 | | |||
23 | #include <QAbstractListModel> | 25 | #include <QAbstractListModel> | ||
24 | #include <QVector> | 26 | #include <QVector> | ||
25 | 27 | | |||
26 | class UnitItem | 28 | class UnitItem | ||
27 | { | 29 | { | ||
28 | public: | 30 | public: | ||
29 | UnitItem() {} | 31 | UnitItem() {} | ||
30 | UnitItem(const QString &_name, KUnitConversion::UnitId _unitId) : name(_name), unitId(_unitId) {} | 32 | UnitItem(KUnitConversion::UnitId _unitId) : name(Util::nameFromUnitId(_unitId)), unitId(_unitId) {} | ||
31 | 33 | | |||
32 | QString name; | 34 | QString name; | ||
33 | KUnitConversion::UnitId unitId; | 35 | KUnitConversion::UnitId unitId; | ||
34 | }; | 36 | }; | ||
35 | 37 | | |||
36 | Q_DECLARE_METATYPE(UnitItem) | 38 | Q_DECLARE_METATYPE(UnitItem) | ||
37 | Q_DECLARE_TYPEINFO(UnitItem, Q_MOVABLE_TYPE); | 39 | Q_DECLARE_TYPEINFO(UnitItem, Q_MOVABLE_TYPE); | ||
38 | 40 | | |||
Show All 21 Lines |