Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to reload a qml changing contents.
Forum Updated to NodeBB v4.3 + New Features

How to reload a qml changing contents.

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 846 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yongsungkim
    wrote on last edited by
    #1

    I tried to develop UI in QML. The development environment is embedded. This environment spends a lot of time to boot. So, Tries to use the following method with Loader element.

    //Main.qml
    @
    Rectangle {
    width: 800; height: 600; color:"blue"

    Column{
        width: parent.width; height: parent.height
        Row{
            width:parent.width; height:parent.height*0.2
            Rectangle{
                id: runButton
    
                width: parent.width*0.2; height: parent.height*0.8
                color: "red"
                Text{
                    text: "RUN";   color:"white";  font.pointSize: 20;    anchors.centerIn: parent
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        readyGO.source= "./test3.qml"
                    }
    
                }
            }
    
            Rectangle{
                id: quitButton
                width: parent.width*0.2
                height: parent.height*0.8
    
                color: "green"
    
                Text{
                    text: "Quit"
                    color: "white"
                    font.pointSize: 30
                    anchors.centerIn: parent
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                     testMain.source= ""
                    }
                }
            }
        }
        Rectangle{
            width: parent.width*0.8
            height: parent.height*0.8
    

    anchors.horizontalCenter: parent.horizontalCenter
    Loader{
    id: testMain
    }
    }
    }
    }

    // test3.qml
    Rectangle {
    id: rect
    width: 360
    height: 360
    Text {
    anchors.centerIn: parent
    text: "~~~~~~~~~~asfsdfas~" // changing contents -> "Hello"
    }
    }
    @
    and then, The contents of the file(test3.qml) have changed.
    But, After fixing the contents of the file is not applied.

    Could you tell men How to reload a changing qml File?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved