Important: Please read the Qt Code of Conduct -

StackView properties

  • Hello,

    I am a beginner with QT. I try to use Stackview component in QML.

    But I have a problem.
    I have two qml files, my first qml file contain a stackview.

    I push a new qml file with:
    its woking fine

    But now I want send properties to my second qml file.
    stackView.push({item : Qt.resolvedUrl("second.qml"), properties : { locale : qsTr("test param") }})

    its working but I dont know how to get "locale" parameter value in second.qml :(

    Any idea ?

  • I have find a solution,

    1.add this line in first qml file and in second qml file :

    property string locale

    1. and to push second qml file use :

    stackView.push({item : Qt.resolvedUrl("second.qml"), properties : { "locale" : "test param" }})

    1. in the second qml file the value can be read in locale property.

Log in to reply