mohsen
mohsen

Reputation: 1806

How use qml types in main qml file from other qml file

I have a TextField in main.qml file

main.qml

ApplicationWindow {
    id: mainWindow

 header: ToolBar{
    id: tbMain

    TextField{
        id: tfsearch
    }
}
}

in main.qml file I have StackView that I add searchresult.qml to this stackview.

I want to know in searchresult.qml how use textchanged signal and text property of TextField that is in main.qml

Upvotes: 0

Views: 404

Answers (1)

dtech
dtech

Reputation: 49289

In searchresult.qml:

Connections {
  target: tfsearch
  onTextChanged: doStuff()
}

Upvotes: 1

Related Questions