From 5c4cc9aedbd60756e759f4ae67032485edfaabd8 Mon Sep 17 00:00:00 2001 From: dorian Date: Sat, 23 Mar 2019 09:36:50 +0100 Subject: [PATCH] some changes --- .gitignore | 1 + headers/appsettings.h | 4 ++-- qml/ShopPopup.qml | 45 ++++++++++++++++++++++++++++++++++++++--- sources/appsettings.cpp | 4 ++-- 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..75c107b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pro.user diff --git a/headers/appsettings.h b/headers/appsettings.h index 144d49c..d65b5e2 100644 --- a/headers/appsettings.h +++ b/headers/appsettings.h @@ -30,10 +30,10 @@ signals: void themeChanged(); public slots: - Q_INVOKABLE QString read(const QString &key); + Q_INVOKABLE QString read(QString key); // function to read values from the settings file - Q_INVOKABLE void write(const QString &key, const QVariant &value); + Q_INVOKABLE void write(QString key, QVariant value); // function to write values to the settings file Q_INVOKABLE void setDefault(const QString &key, const QVariant &defaultValue); diff --git a/qml/ShopPopup.qml b/qml/ShopPopup.qml index 828fb4a..d4d7ecf 100644 --- a/qml/ShopPopup.qml +++ b/qml/ShopPopup.qml @@ -31,13 +31,52 @@ Popup { topMargin: -topImg.anchors.bottomMargin } - Column { + ListView { anchors.fill: parent - ShopDelegate { - + model: ListModel { + ListElement { + iconSource: "qrc:/icons/cookie.png" + costIconSource: "qrc:/icons/cookie.png" + title: "Titel" + cost: "10" + levelLabel: "Level:" + level: "10" + useLabel: "Cps:" + use: "+10" + } + ListElement { + iconSource: "qrc:/icons/cookie.png" + costIconSource: "qrc:/icons/cookie.png" + title: "Titel2" + cost: "100" + levelLabel: "Level:" + level: "10" + useLabel: "Cps:" + use: "+10" + } + ListElement { + iconSource: "qrc:/icons/cookie.png" + costIconSource: "qrc:/icons/cookie.png" + title: "Titel3" + cost: "1000" + levelLabel: "Level:" + level: "10" + useLabel: "Cps:" + use: "+10" + } } + delegate: ShopDelegate { + iconSource: model.iconSource + costIconSource: model.costIconSource + title: model.title + cost: model.cost + levelLabel: model.levelLabel + level: model.level + useLabel: model.useLabel + use: model.use + } } } } diff --git a/sources/appsettings.cpp b/sources/appsettings.cpp index 46a781d..f4e2d8b 100644 --- a/sources/appsettings.cpp +++ b/sources/appsettings.cpp @@ -20,7 +20,7 @@ AppSettings::AppSettings(QObject* parent) this->themeSettingsManager = new QSettings(":/themes/" + this->read("theme") + ".ini", QSettings::IniFormat); } -QString AppSettings::read(const QString &key) +QString AppSettings::read(QString key) { // function to read values from the settings file @@ -34,7 +34,7 @@ QString AppSettings::read(const QString &key) return(value); } -void AppSettings::write(const QString &key, const QVariant &value) +void AppSettings::write(QString key, QVariant value) { // function to write values to the settings file