main.qml
import QtQuick 2.10
Rectangle {
id: rectangle
signal searchTextEditedSignal(string text)
SearchBox {
id: search1
textInput.onTextEditedSignal: searchTextEditedSignal(text)
}
}
SearchBox.qml
import QtQuick 2.10
FocusScope {
id: focusScope
width: 250; height: 28
TextInput {
id: textInput
signal textEditedSignal(string msg)
selectByMouse: true
onTextEdited: {
textEditedSignal(textInput.text)
}
}
}
Then I got error at runtime:
qrc:/main.qml:15:9: Cannot assign to non-existent property "textInput"
I want to invoke the searchTextEditedSignal
signal and use it in C++ code: connected to a C++ function. But the real invoker is the TextInput
inside SearchBox.qml, so I need to delegate the textEditedSignal
from SearchBox.qml to main.qml.