QML attributes in C++

  • Hello,

    maybe I'm just too tired to find my mistake, but I wasn´t able to find a solution for my problem, so well...

    In QML I made TextInput. If now onAccepted is called I want to integrate the TextInput´s text in C++, so for example that a file can be created that has the user input as its name.

    Can anybody help?


  • Moderators

    Hi @DanBoSlice, it can be done as follows:

    • On C++ side, use findChild to get the TextInput object. You can find example here
    • Since TextInput has accepted signal you can connect to it and call your slot.
    • The in slot you can access the TextInput's text by the object found using findChild.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.