From de670905b25f9af9e65d071025b8997fc0c0d39a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 6 Dec 2017 09:15:48 +0100 Subject: Fixed controller clear function Adding a property from QML changes the offset from 1 to 20 for the composercontroller, which results in the clear function not working. Since we know that QObjects property offset is 1, we can just hardcode that number. Not the cleanest solution, so it would be good to find a better approach at some point. --- framework/src/domain/controller.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/domain/controller.cpp b/framework/src/domain/controller.cpp index 82a761f6..21dbb69a 100644 --- a/framework/src/domain/controller.cpp +++ b/framework/src/domain/controller.cpp @@ -46,7 +46,9 @@ void ControllerAction::execute() void Controller::clear() { auto meta = metaObject(); - for (auto i = meta->propertyOffset(); i < meta->propertyCount(); i++) { + //FIXME meta->propertyOffset() changes as soon as we add a property from QML. We know that QObject has an offset of 1. + auto offset = 1; + for (auto i = offset; i < meta->propertyCount(); i++) { auto property = meta->property(i); setProperty(property.name(), QVariant()); } -- cgit v1.2.3