From 6c0cdd5eac3c32e2b8eb1f4433f741322b8f87cc Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Wed, 27 Jun 2018 20:23:31 +0200 Subject: [PATCH] added automatic c++ variant type conversion for inputs, as the qml (js) conversion can conflict with the cpp one. Now everything is converted in cpp, preventing such problems --- examples/mvvmquick/SampleQuick/TabView.qml | 1 - src/imports/mvvmcore/plugins.qmltypes | 6 +++ src/imports/mvvmcore/qqmlcoreapp.cpp | 5 ++ src/imports/mvvmcore/qqmlcoreapp.h | 1 + src/imports/mvvmquick/DateEdit.qml | 10 ++-- src/imports/mvvmquick/DialogPresenter11.qml | 1 - src/imports/mvvmquick/PresentingStackView.qml | 1 - .../mvvmquick/PresentingStackView11.qml | 1 - src/imports/mvvmquick/TimeEdit.qml | 2 +- src/imports/mvvmquick/settingsentrymodel.cpp | 10 +++- src/imports/mvvmquick/settingsentrymodel.h | 2 + src/mvvmcore/coreapp.cpp | 49 +++++++++++++++++++ src/mvvmcore/coreapp.h | 11 +++++ src/mvvmcore/coreapp_p.h | 3 ++ src/mvvmcore/message.cpp | 5 +- src/mvvmquick/BoolDelegate.qml | 11 +---- src/mvvmquick/DateEdit.qml | 13 +---- src/mvvmquick/DateTimeEdit.qml | 24 ++++----- src/mvvmquick/SwitchDelegate.qml | 11 +---- src/mvvmquick/TimeEdit.qml | 13 +---- src/mvvmquick/inputviewfactory.cpp | 1 + src/mvvmquick/inputviewfactory.h | 2 +- src/mvvmwidgets/inputwidgetfactory.cpp | 2 +- src/mvvmwidgets/settingsdialog.cpp | 10 +++- src/mvvmwidgets/settingsdialog_p.h | 2 + src/mvvmwidgets/widgetspresenter.cpp | 1 + 26 files changed, 127 insertions(+), 71 deletions(-) diff --git a/examples/mvvmquick/SampleQuick/TabView.qml b/examples/mvvmquick/SampleQuick/TabView.qml index 4954862..f3cf2cd 100644 --- a/examples/mvvmquick/SampleQuick/TabView.qml +++ b/examples/mvvmquick/SampleQuick/TabView.qml @@ -64,7 +64,6 @@ Page { } function presentTab(item) { - console.log("here"); tabBar.insertItem(tabBar.count - 1, _newTab.createObject(tabBar, {viewModel: item.viewModel})); item.parent = swipe; swipe.addItem(item); diff --git a/src/imports/mvvmcore/plugins.qmltypes b/src/imports/mvvmcore/plugins.qmltypes index f53cd4e..e902204 100644 --- a/src/imports/mvvmcore/plugins.qmltypes +++ b/src/imports/mvvmcore/plugins.qmltypes @@ -119,6 +119,12 @@ Module { type: "QtMvvm::MessageResult*" Parameter { name: "config"; type: "QtMvvm::MessageConfig" } } + Method { + name: "safeCastInputType" + type: "QVariant" + Parameter { name: "type"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } } Component { name: "QtMvvm::QQmlMvvmBinding" diff --git a/src/imports/mvvmcore/qqmlcoreapp.cpp b/src/imports/mvvmcore/qqmlcoreapp.cpp index 9f6acc8..633d407 100644 --- a/src/imports/mvvmcore/qqmlcoreapp.cpp +++ b/src/imports/mvvmcore/qqmlcoreapp.cpp @@ -13,6 +13,11 @@ MessageResult *QQmlCoreApp::showDialog(const MessageConfig &config) return CoreApp::showDialog(config); } +QVariant QQmlCoreApp::safeCastInputType(const QString &type, const QVariant &value) +{ + return CoreApp::safeCastInputType(type.toUtf8(), value); +} + void QQmlCoreApp::show(const QString &viewModelName, const QVariantHash ¶ms, ViewModel *parentViewModel) { CoreApp::show(qUtf8Printable(viewModelName), params, parentViewModel); diff --git a/src/imports/mvvmcore/qqmlcoreapp.h b/src/imports/mvvmcore/qqmlcoreapp.h index 966efa0..c41525d 100644 --- a/src/imports/mvvmcore/qqmlcoreapp.h +++ b/src/imports/mvvmcore/qqmlcoreapp.h @@ -15,6 +15,7 @@ public: explicit QQmlCoreApp(QObject *parent = nullptr); Q_INVOKABLE QtMvvm::MessageResult *showDialog(const QtMvvm::MessageConfig &config); + Q_INVOKABLE QVariant safeCastInputType(const QString &type, const QVariant &value); public Q_SLOTS: void show(const QString &viewModelName, const QVariantHash ¶ms = {}, QtMvvm::ViewModel *parentViewModel = nullptr); diff --git a/src/imports/mvvmquick/DateEdit.qml b/src/imports/mvvmquick/DateEdit.qml index 5dff60f..fae957f 100644 --- a/src/imports/mvvmquick/DateEdit.qml +++ b/src/imports/mvvmquick/DateEdit.qml @@ -9,7 +9,7 @@ ListView { property date firstDate: new Date(1970, 0, 1) property date lastDate: new Date(9999, 11, 31) - property date currentDate: today(); + property date date: today(); function today() { var cDate = new Date(); @@ -26,14 +26,14 @@ ListView { if(_skipNextFocus) _skipNextFocus = false; else { - _calenderList.currentIndex = calendarModel.indexOf(_calenderList.currentDate); + _calenderList.currentIndex = calendarModel.indexOf(_calenderList.date); _calenderList.positionViewAtIndex(_calenderList.currentIndex, ListView.SnapPosition); } } } Component.onCompleted: _p.focusDate() - onCurrentDateChanged: _p.focusDate() + onDateChanged: _p.focusDate() implicitWidth: 300 implicitHeight: 200 @@ -120,7 +120,7 @@ ListView { id: helper } - readonly property bool isCurrent: model.day === _calenderList.currentDate.getDate() && model.month === _calenderList.currentDate.getMonth() + readonly property bool isCurrent: model.day === _calenderList.date.getDate() && model.month === _calenderList.date.getMonth() readonly property alias highlightColor: helper.highlight horizontalAlignment: Text.AlignHCenter @@ -160,7 +160,7 @@ ListView { _calenderList.incrementCurrentIndex(); _p._skipNextFocus = true; } - _calenderList.currentDate = model.date; + _calenderList.date = model.date; } } } diff --git a/src/imports/mvvmquick/DialogPresenter11.qml b/src/imports/mvvmquick/DialogPresenter11.qml index ac18a05..8323556 100644 --- a/src/imports/mvvmquick/DialogPresenter11.qml +++ b/src/imports/mvvmquick/DialogPresenter11.qml @@ -209,7 +209,6 @@ QtObject { var props = config.viewProperties; props["msgConfig"] = config; props["msgResult"] = result; - console.log(config.buttons); var incubator = _inputComponent.incubateObject(rootItem, props, Qt.Synchronous); return incubator.status !== Component.Error; } diff --git a/src/imports/mvvmquick/PresentingStackView.qml b/src/imports/mvvmquick/PresentingStackView.qml index 94ac8f1..d813774 100644 --- a/src/imports/mvvmquick/PresentingStackView.qml +++ b/src/imports/mvvmquick/PresentingStackView.qml @@ -160,7 +160,6 @@ StackView { */ function safeReplace(target, item, properties, operation) { var items = []; - console.log("current depth: ", depth) for(var i = depth -1; i >= 0; i--) { var cItem = get(i, StackView.ForceLoad); _clearItems.push(cItem); diff --git a/src/imports/mvvmquick/PresentingStackView11.qml b/src/imports/mvvmquick/PresentingStackView11.qml index aa2a033..6d8660b 100644 --- a/src/imports/mvvmquick/PresentingStackView11.qml +++ b/src/imports/mvvmquick/PresentingStackView11.qml @@ -156,7 +156,6 @@ StackView { */ function safeReplace(target, item, properties, operation) { var items = []; - console.log("current depth: ", depth) for(var i = depth -1; i >= 0; i--) { var cItem = get(i, StackView.ForceLoad); _clearItems.push(cItem); diff --git a/src/imports/mvvmquick/TimeEdit.qml b/src/imports/mvvmquick/TimeEdit.qml index 5ab8904..2fd29da 100644 --- a/src/imports/mvvmquick/TimeEdit.qml +++ b/src/imports/mvvmquick/TimeEdit.qml @@ -12,7 +12,7 @@ RowLayout { _forceTime = time } - property var _forceTime: new Date() + property date _forceTime: new Date() property bool showHours: true property bool showMinutes: true diff --git a/src/imports/mvvmquick/settingsentrymodel.cpp b/src/imports/mvvmquick/settingsentrymodel.cpp index 899eb4e..3a95109 100644 --- a/src/imports/mvvmquick/settingsentrymodel.cpp +++ b/src/imports/mvvmquick/settingsentrymodel.cpp @@ -1,6 +1,7 @@ #include "settingsentrymodel.h" #include +#include using namespace QtMvvm; @@ -77,7 +78,7 @@ QVariant SettingsEntryModel::data(const QModelIndex &index, int role) const case DelegateUrlRole: return entry.delegateUrl; case SettingsValueRole: - return _viewModel->loadValue(entry.key, entry.defaultValue); + return readValue(entry); case PropertiesRole: return entry.properties; case GroupRole: @@ -92,7 +93,7 @@ QVariant SettingsEntryModel::data(const QModelIndex &index, int role) const else if(preview.type() == QVariant::String) { return _factory->format(entry.type, preview.toString(), - _viewModel->loadValue(entry.key, entry.defaultValue), + readValue(entry), entry.properties); } } @@ -154,6 +155,11 @@ void SettingsEntryModel::entryChanged(const QString &key) } } +QVariant SettingsEntryModel::readValue(const SettingsElements::Entry &entry) const +{ + return CoreApp::safeCastInputType(entry.type, _viewModel->loadValue(entry.key, entry.defaultValue)); +} + SettingsEntryModel::EntryInfo::EntryInfo(SettingsElements::Entry entry, QUrl delegateUrl, SettingsElements::Group group) : diff --git a/src/imports/mvvmquick/settingsentrymodel.h b/src/imports/mvvmquick/settingsentrymodel.h index 95167fa..281a0bd 100644 --- a/src/imports/mvvmquick/settingsentrymodel.h +++ b/src/imports/mvvmquick/settingsentrymodel.h @@ -57,6 +57,8 @@ private: SettingsViewModel *_viewModel = nullptr; InputViewFactory *_factory = nullptr; QList _entries; + + QVariant readValue(const SettingsElements::Entry &entry) const; }; } diff --git a/src/mvvmcore/coreapp.cpp b/src/mvvmcore/coreapp.cpp index 264d0e7..234c5bf 100644 --- a/src/mvvmcore/coreapp.cpp +++ b/src/mvvmcore/coreapp.cpp @@ -97,6 +97,38 @@ MessageResult *CoreApp::showDialog(const MessageConfig &config) return result; } +QVariant CoreApp::safeCastInputType(const QByteArray &type, const QVariant &value) +{ + // get the target type, either explicitly or from the name + auto mType = CoreAppPrivate::dInstance()->inputTypeMapping.value(type, QMetaType::UnknownType); + if(mType == QMetaType::UnknownType) { + mType = QMetaType::type(type.constData()); + if(mType == QMetaType::UnknownType) { // no type found -> do nothing but warn + logWarning() << "Input type" << type << "has no know C++ type to convert it to. Use QtMvvm::CoreApp::registerInputTypeMapping to add it." + << "To surpress this warning without performing a conversion, register it as `CoreApp::registerInputTypeMapping(" << type << ");`"; + return value; + } + } + + // target type is QVariant -> return without converting + if(mType == QMetaType::QVariant) + return value; + + auto convValue = value; + if(!convValue.convert(mType)) { + logWarning() << "Failed to convert data for input type" << type + << "from given type" << value.typeName() + << "to the target type" << QMetaType::typeName(mType); + return value; + } else + return convValue; +} + +void CoreApp::registerInputTypeMapping(const QByteArray &type, int targetType) +{ + CoreAppPrivate::dInstance()->inputTypeMapping.insert(type, targetType); +} + void CoreApp::bootApp() { if(!d->presenter) { @@ -181,6 +213,23 @@ void CoreApp::showImp(const QMetaObject *metaObject, const QVariantHash ¶ms, bool CoreAppPrivate::bootEnabled = true; QPointer CoreAppPrivate::instance = nullptr; +CoreAppPrivate::CoreAppPrivate() : + inputTypeMapping{ + {"switch", QMetaType::Bool}, + {"string", QMetaType::QString}, + {"number", QMetaType::Double}, + {"range", QMetaType::Int}, + {"date", QMetaType::QDateTime}, + {"color", QMetaType::QColor}, + {"url", QMetaType::QUrl}, + {"var", QMetaType::QVariant}, + {"variant", QMetaType::QVariant}, + {"selection", QMetaType::QVariant}, + {"list", QMetaType::QVariant}, + {"radiolist", QMetaType::QVariant}, + } +{} + QScopedPointer &CoreAppPrivate::dInstance() { return instance->d; diff --git a/src/mvvmcore/coreapp.h b/src/mvvmcore/coreapp.h index 3aa7100..a3aee9b 100644 --- a/src/mvvmcore/coreapp.h +++ b/src/mvvmcore/coreapp.h @@ -47,6 +47,11 @@ public: //! Show a basic dialog static MessageResult *showDialog(const MessageConfig &config); + static QVariant safeCastInputType(const QByteArray &type, const QVariant &value); + static void registerInputTypeMapping(const QByteArray &type, int targetType); + template + static void registerInputTypeMapping(const QByteArray &type); + public Q_SLOTS: //! Boots up the app and starts the mvvm presenting void bootApp(); @@ -81,6 +86,12 @@ inline void CoreApp::show(const QVariantHash ¶ms, QPointer parent showImp(&TViewModel::staticMetaObject, params, std::move(parentViewModel)); } +template +void CoreApp::registerInputTypeMapping(const QByteArray &type) +{ + registerInputTypeMapping(type, qMetaTypeId()); +} + } //! Registers you custom CoreApp class as CoreApp to be used diff --git a/src/mvvmcore/coreapp_p.h b/src/mvvmcore/coreapp_p.h index bd0866b..e4ccaf0 100644 --- a/src/mvvmcore/coreapp_p.h +++ b/src/mvvmcore/coreapp_p.h @@ -14,6 +14,8 @@ class Q_MVVMCORE_EXPORT CoreAppPrivate : public QObject friend class QtMvvm::CoreApp; public: + CoreAppPrivate(); + static QScopedPointer &dInstance(); public Q_SLOTS: @@ -28,6 +30,7 @@ private: static QPointer instance; IPresenter *presenter = nullptr; + QHash inputTypeMapping; QHash> singleInstances; bool isSingleton(const QMetaObject *metaObject) const; diff --git a/src/mvvmcore/message.cpp b/src/mvvmcore/message.cpp index 8a20942..0d9fdf5 100644 --- a/src/mvvmcore/message.cpp +++ b/src/mvvmcore/message.cpp @@ -76,7 +76,10 @@ QHash MessageConfig::buttonTexts() const QVariant MessageConfig::defaultValue() const { - return d->defaultValue; + if(d->type == MessageConfig::TypeInputDialog) + return CoreApp::safeCastInputType(d->subType, d->defaultValue); + else + return d->defaultValue; } QVariantMap MessageConfig::viewProperties() const diff --git a/src/mvvmquick/BoolDelegate.qml b/src/mvvmquick/BoolDelegate.qml index acdd4f3..b9df077 100644 --- a/src/mvvmquick/BoolDelegate.qml +++ b/src/mvvmquick/BoolDelegate.qml @@ -8,16 +8,9 @@ CheckDelegate { text: title - function asBool(value) { - if(typeof value == "string") - return value === "true"; - else - return Boolean(value); - } - - checked: asBool(inputValue) + checked: inputValue onCheckedChanged: { - if(asBool(inputValue) !== checked) + if(inputValue !== checked) inputValue = checked; } diff --git a/src/mvvmquick/DateEdit.qml b/src/mvvmquick/DateEdit.qml index 4041015..697c887 100644 --- a/src/mvvmquick/DateEdit.qml +++ b/src/mvvmquick/DateEdit.qml @@ -3,16 +3,5 @@ import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm QtMvvm.DateEdit { id: _edit - - property var inputValue: new Date() - - onInputValueChanged: { - var realDate = typeof inputValue == "string" ? new Date(inputValue + "T00:00:00") : inputValue - if(realDate.getDate() !== currentDate.getDate() || - realDate.getMonth() !== currentDate.getMonth() || - realDate.getYear() !== currentDate.getYear()) { - currentDate = realDate - } - } - onCurrentDateChanged: inputValue = currentDate + property alias inputValue: _edit.date } diff --git a/src/mvvmquick/DateTimeEdit.qml b/src/mvvmquick/DateTimeEdit.qml index 9879150..e3f9bba 100644 --- a/src/mvvmquick/DateTimeEdit.qml +++ b/src/mvvmquick/DateTimeEdit.qml @@ -10,23 +10,23 @@ ColumnLayout { property var inputValue: new Date() - readonly property date combinedDate: new Date(_dateEdit.currentDate.getFullYear(), - _dateEdit.currentDate.getMonth(), - _dateEdit.currentDate.getDate(), + readonly property date combinedDate: new Date(_dateEdit.date.getFullYear(), + _dateEdit.date.getMonth(), + _dateEdit.date.getDate(), _timeEdit.time.getHours(), _timeEdit.time.getMinutes(), _timeEdit.time.getSeconds()) onInputValueChanged: { - var realDate = typeof inputValue == "string" ? new Date(inputValue) : inputValue - if(realDate.getYear() !== combinedDate.getYear() || - realDate.getMonth() !== combinedDate.getMonth() || - realDate.getDate() !== combinedDate.getDate() || - realDate.getHours() !== combinedDate.getHours() || - realDate.getMinutes() !== combinedDate.getMinutes() || - realDate.getSeconds() !== combinedDate.getSeconds()) { - _dateEdit.currentDate = realDate; - _timeEdit.time = realDate; + var newDate = inputValue; + if(newDate.getYear() !== combinedDate.getYear() || + newDate.getMonth() !== combinedDate.getMonth() || + newDate.getDate() !== combinedDate.getDate() || + newDate.getHours() !== combinedDate.getHours() || + newDate.getMinutes() !== combinedDate.getMinutes() || + newDate.getSeconds() !== combinedDate.getSeconds()) { + _dateEdit.date = newDate; + _timeEdit.time = newDate; } } onCombinedDateChanged: { diff --git a/src/mvvmquick/SwitchDelegate.qml b/src/mvvmquick/SwitchDelegate.qml index ce98814..a94bb08 100644 --- a/src/mvvmquick/SwitchDelegate.qml +++ b/src/mvvmquick/SwitchDelegate.qml @@ -8,16 +8,9 @@ Controls.SwitchDelegate { text: title - function asBool(value) { - if(typeof value == "string") - return value === "true"; - else - return Boolean(value); - } - - checked: asBool(inputValue) + checked: inputValue onCheckedChanged: { - if(asBool(inputValue) !== checked) + if(inputValue !== checked) inputValue = checked; } diff --git a/src/mvvmquick/TimeEdit.qml b/src/mvvmquick/TimeEdit.qml index 9eb6768..f40bc6b 100644 --- a/src/mvvmquick/TimeEdit.qml +++ b/src/mvvmquick/TimeEdit.qml @@ -3,16 +3,5 @@ import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm QtMvvm.TimeEdit { id: _edit - - property var inputValue: new Date() - - onInputValueChanged: { - var realTime = typeof inputValue == "string" ? new Date("2000-01-01T" + inputValue) : inputValue - if(realTime.getHours() !== time.getHours() || - realTime.getMinutes() !== time.getMinutes() || - realTime.getSeconds() !== time.getSeconds()) { - time = realTime - } - } - onTimeChanged: inputValue = time + property alias inputValue: _edit.time } diff --git a/src/mvvmquick/inputviewfactory.cpp b/src/mvvmquick/inputviewfactory.cpp index 4c5de3d..2c49061 100644 --- a/src/mvvmquick/inputviewfactory.cpp +++ b/src/mvvmquick/inputviewfactory.cpp @@ -123,6 +123,7 @@ InputViewFactoryPrivate::InputViewFactoryPrivate() : {"color", QStringLiteral("qrc:/qtmvvm/inputs/ColorEdit.qml")}, {QMetaType::typeName(QMetaType::QFont), QStringLiteral("qrc:/qtmvvm/inputs/FontEdit.qml")}, {QMetaType::typeName(QMetaType::QUrl), QStringLiteral("qrc:/qtmvvm/inputs/UrlField.qml")}, + {"url", QStringLiteral("qrc:/qtmvvm/inputs/UrlField.qml")}, {"selection", QStringLiteral("qrc:/qtmvvm/inputs/ListEdit.qml")}, {"list", QStringLiteral("qrc:/qtmvvm/inputs/ListEdit.qml")}, {"radiolist", QStringLiteral("qrc:/qtmvvm/inputs/RadioListEdit.qml")} diff --git a/src/mvvmquick/inputviewfactory.h b/src/mvvmquick/inputviewfactory.h index 96f359f..9ab85fe 100644 --- a/src/mvvmquick/inputviewfactory.h +++ b/src/mvvmquick/inputviewfactory.h @@ -68,7 +68,7 @@ public: template inline void addFormatter(Formatter *formatter); - void addFormatter(const QByteArray &type, Formatter *formatter); + void addFormatter(const QByteArray &type, Formatter *formatter); //MAJOR make virtual //! Adds a type name alias for views template diff --git a/src/mvvmwidgets/inputwidgetfactory.cpp b/src/mvvmwidgets/inputwidgetfactory.cpp index a97bb97..74c7077 100644 --- a/src/mvvmwidgets/inputwidgetfactory.cpp +++ b/src/mvvmwidgets/inputwidgetfactory.cpp @@ -79,7 +79,7 @@ QWidget *InputWidgetFactory::createInput(const QByteArray &type, QWidget *parent } else if(type == "selection" || type == "list") widget = new SelectComboBox(parent); else - throw PresenterException("Unable to find an input view for type" + type); + throw PresenterException("Unable to find an input view for type: " + type); for(auto it = viewProperties.constBegin(); it != viewProperties.constEnd(); it++) widget->setProperty(qUtf8Printable(it.key()), it.value()); diff --git a/src/mvvmwidgets/settingsdialog.cpp b/src/mvvmwidgets/settingsdialog.cpp index 6b2bcca..7cbe261 100644 --- a/src/mvvmwidgets/settingsdialog.cpp +++ b/src/mvvmwidgets/settingsdialog.cpp @@ -11,6 +11,7 @@ #include #include +#include #include using namespace QtMvvm; @@ -115,7 +116,7 @@ void SettingsDialogPrivate::entryChanged(const QString &key) if(!content) return; auto info = entryMap.value(content); - info.second.write(content, viewModel->loadValue(info.first.key, info.first.defaultValue)); + info.second.write(content, readValue(info.first)); } void SettingsDialogPrivate::createCategory(const SettingsElements::Category &category) @@ -200,7 +201,7 @@ void SettingsDialogPrivate::createEntry(const SettingsElements::Entry &entry, QW auto widgetFactory = WidgetsPresenterPrivate::currentPresenter()->inputWidgetFactory(); content = widgetFactory->createInput(entry.type, sectionWidget, entry.properties); auto property = content->metaObject()->userProperty(); - property.write(content, viewModel->loadValue(entry.key, entry.defaultValue)); + property.write(content, readValue(entry)); if(property.hasNotifySignal()) { auto changedSlot = metaObject()->method(metaObject()->indexOfSlot("propertyChanged()")); connect(content, property.notifySignal(), @@ -416,6 +417,11 @@ bool SettingsDialogPrivate::searchInEntry(const QRegularExpression ®ex, QLabe return false; } +QVariant SettingsDialogPrivate::readValue(const SettingsElements::Entry &entry) const +{ + return CoreApp::safeCastInputType(entry.type, viewModel->loadValue(entry.key, entry.defaultValue)); +} + void SettingsDialogPrivate::propertyChanged() { auto widget = qobject_cast(sender()); diff --git a/src/mvvmwidgets/settingsdialog_p.h b/src/mvvmwidgets/settingsdialog_p.h index 37fe5cf..9103c85 100644 --- a/src/mvvmwidgets/settingsdialog_p.h +++ b/src/mvvmwidgets/settingsdialog_p.h @@ -81,6 +81,8 @@ public: bool searchInGroup(const QRegularExpression ®ex, QGroupBox *groupWidget); bool searchInEntry(const QRegularExpression ®ex, QLabel *label, QWidget *content); + QVariant readValue(const SettingsElements::Entry &entry) const; + public Q_SLOTS: void createUi(); void entryChanged(const QString &key); diff --git a/src/mvvmwidgets/widgetspresenter.cpp b/src/mvvmwidgets/widgetspresenter.cpp index bfa9bc9..d1c6013 100644 --- a/src/mvvmwidgets/widgetspresenter.cpp +++ b/src/mvvmwidgets/widgetspresenter.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include