Howto expose ID of an element in an item ?
-
I want to access the getText() function of TextField element, for that i'm trying to expose txtField, but it doesn't work
Item { id: root property alias upload_dialog: upload_dialog property alias txtField: upload_dialog.col.txtField // This doesn't work Dialog { id: upload_dialog . Column { id: col anchors.fill: parent Text { text: "Name" . . } TextField { id: txtField . . } } } }
-
@pingal said in Howto expose ID of an element in an item ?:
property alias txtField: upload_dialog.col.txtField
It is not a hierarchy. Do this instead:
property alias upload_dialog_txtField: txtField // or some other naming that suites you
Edit: Also, for items loaded by loaders or in components you cannot alias to them like that. As far as I can tell you are not doing that.
-
I want to access the getText() function of TextField element, for that i'm trying to expose txtField, but it doesn't work
Item { id: root property alias upload_dialog: upload_dialog property alias txtField: upload_dialog.col.txtField // This doesn't work Dialog { id: upload_dialog . Column { id: col anchors.fill: parent Text { text: "Name" . . } TextField { id: txtField . . } } } }
@pingal I have the feeling I answered this recently....
ah right:https://forum.qt.io/topic/133544/hot-to-reference-to-the-bordercolor