Hi,
Have some issues with itemEditor and the way values in EditableComponent are bind to the item properties they change.
Will try to explain.
I have one itemEditor, one simple Item(id: balance) with one property and one EditableCompoent which changes the balance property.
Whenever I change the balance property,but not from itemEditor, it is not reflected in the itemEditor.
But when I change the property from itemEditor itself, it works fine.
More or less looks like itemEditor is not aware of property changes if it’s done outside.
Here is mu full example.
Basically it is a basic template for Felgo games with one simple change to replicate my issue.
When you click on mousearea I update balance.counter, increase it by 5.
Bu the item editor doesn’t show it unless I add empty EditableComponent, but it breaks other things.
Please look at 2 comments I left in the code.
import Felgo 3.0
import QtQuick 2.0
GameWindow {
id: gameWindow
activeScene: scene
screenWidth: 960
screenHeight: 640
Scene {
id: scene
// the "logical size" - the scene content is auto-scaled to match the GameWindow size
width: 480
height: 320
ItemEditor {
id: itemEditor
z: 1000
visible: true
}
Item {
id: balance
property int counter: 0
}
EditableComponent {
target: balance
properties: {
"Level": {
"counter": {"label": "Counter", "min": 0, "max": 100 },
}
}
}
// If I uncomment this empty EditableComponent itemEditor will start reflecting external changes of balance.counter BUT this will break things like
// saving level in LevelEditor, LevelEditor will start saving empty data for EditableComponent, HELP
//EditableComponent {}
Rectangle {
id: rectangle
color: "green"
x: itemEditor.width
width: scene.width - itemEditor.width
height: parent.height
Text {
id: textElement
// qsTr() uses the internationalization feature for multi-language support
text: qsTr("Current counter value is " + balance.counter)
color: "red"
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
z: 1001
onClicked: {
balance.counter += 5
// this change by default is not reflected in itemEditor!!!!
}
}
}
}
}
Either it is a bug or I don’t understand how it should work.