diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-28 19:51:52 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-01 11:57:43 +0100 |
commit | fea05bb0dba069c82b9dbe2a71b31f88cf54a712 (patch) | |
tree | 86516997de75fb734a03f9a532bc6d821aba847b /components/package/contents/ui/FolderListView.qml | |
parent | 0203557d72eceddf19bbca8143e12be95adab2d7 (diff) | |
download | kube-fea05bb0dba069c82b9dbe2a71b31f88cf54a712.tar.gz kube-fea05bb0dba069c82b9dbe2a71b31f88cf54a712.zip |
Avoid "Unable to assign...." errors
i.e. "Unable to assign [undefined] to Sink::ApplicationDomain::Folder::Ptr"
Because qml does not know how to assign a default-constructed value we
have to use conditional bindings. The !! operator checks for
availability of the property which then triggers the binding.
I assume an alternative viable approach would be to expose all
controller properties as QVariants only, in which case an assignment
from null would work (it doesn't for Folder::Ptr).
Diffstat (limited to 'components/package/contents/ui/FolderListView.qml')
-rw-r--r-- | components/package/contents/ui/FolderListView.qml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml index 9ac73fb4..a4d25e02 100644 --- a/components/package/contents/ui/FolderListView.qml +++ b/components/package/contents/ui/FolderListView.qml | |||
@@ -28,14 +28,18 @@ import org.kube.framework.domain 1.0 as KubeFramework | |||
28 | Rectangle { | 28 | Rectangle { |
29 | id: root | 29 | id: root |
30 | 30 | ||
31 | property variant currentFolder | 31 | property variant currentFolder: null |
32 | property variant accountId | 32 | property variant accountId |
33 | 33 | ||
34 | color: Kirigami.Theme.textColor | 34 | color: Kirigami.Theme.textColor |
35 | 35 | ||
36 | KubeFramework.FolderController { | 36 | KubeFramework.FolderController { |
37 | id: folderController | 37 | id: folderController |
38 | folder: root.currentFolder | 38 | Binding on folder { |
39 | //!! checks for the availability of the type | ||
40 | when: !!root.currentFolder | ||
41 | value: root.currentFolder | ||
42 | } | ||
39 | } | 43 | } |
40 | 44 | ||
41 | Menu { | 45 | Menu { |