Reputation: 7448
I'm editing a component in Qt Creator. It suggested me to split the component in UI and not UI parts. My components exposes 2 custom properties.
ComponentViewForm {
property string step: '0'
property string setStep: '0'
}
step
setStep
in onAccepted
handler.First one is easy. The binding can be edited in UI-Editor directly But how do I implement the signal-handler of the child? I've implemented it directly in the UI.
TextInput {
id: step
text: parent.step
onAccepted:
{
parent.setStep = text
}
}
It works, but Qt-Creator rejects to open it in UI-mode any more.
Upvotes: 2
Views: 1423
Reputation: 3359
You can export the TextInput
from your ComponentViewForm
. There's a small Export button in the Navigator tab in Qt Quick UI forms editor. Assume that the id of TextInput
is stepInput
, ComponentViewForm.ui.qml should have an alias property property alias stepInput: stepInput
in source code after you click the Export button.
You can implement property binding and signal handlers in ComponentView.qml like this:
ComponentViewForm {
property string step: '0'
property string setStep: '0'
stepInput.text: step
stepInput.onAccepted:
{
setStep = stepInput.text;
}
}
Upvotes: 2