demo5.qml 784 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import QtQuick 1.0
  2. /**
  3. * Multiple properties are allowed, as is mixing "local" and aliased properties.
  4. */
  5. Rectangle {
  6. width: 300
  7. height: 300
  8. PersistentObject {
  9. id: storedObject
  10. // Local properties
  11. property string someString: "initial text"
  12. property int someInt: 3
  13. property bool someBool: true
  14. property variant someArray: [1,2,3]
  15. property variant someObject: {"foo": "bar", "nut": "bolt"}
  16. // Aliased property
  17. property alias someText: textInput.text
  18. }
  19. Column {
  20. TextInput {
  21. text: storedObject.someObject.nut // This works
  22. onTextChanged: storedObject.someObject.nut = text // But this doesn't work, the object is never updated. Bug in QtQuick?
  23. }
  24. TextInput {
  25. id: textInput
  26. text: "initial text"
  27. }
  28. }
  29. }