Overlapping QML



  • @ //choose2chiuaua.qml

    import QtQuick 1.0

    Rectangle {
    width: choose_chiuaua.width; height: choose_chiuaua.height

    Loader {
    id: mainLoader
    anchors.fill: parent

    MouseArea {
    id: cchoose2menu
    x: 162
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "menu.qml";}
    }

    MouseArea {
    id: cchoose2name
    x: 0
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "naming_pet.qml";}
    }

    MouseArea {
    id: chiuaua_next
    x: 191
    y: 178
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2shitzu.qml";}

    }

    MouseArea {
    id: chiuaua_back
    x: 12
    y: 179
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2aspin.qml";}

    }

    AnimatedImage { id: choose_chiuaua; x: 0; y: 0; width: 240; height: 316;
    source: "Choose Pet (Chiuaua)" } // GIF FILE
    }
    }@

    @// choose2aspin.qml

    import QtQuick 1.0

    Rectangle {
    width: choose_aspin.width; height: choose_aspin.height

    Loader {
    id: mainLoader
    anchors.fill: parent

    MouseArea {
    id: achoose2menu
    x: 162
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "menu.qml";}
    }

    MouseArea {
    id: achoose2name
    x: 0
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "naming_pet.qml";}
    }

    MouseArea {
    id: aspin_next
    x: 191
    y: 178
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2chiuaua.qml";}
    }

    MouseArea {
    id: aspin_back
    x: 12
    y: 179
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2shitzu.qml";}

    }

    AnimatedImage { id: choose_aspin; x: 0; y: 0; width: 240; height: 316;
    source: "Choose Pet (Aspin)" } //GIF FILE
    }
    }
    @

    @//choose2shitzu.qml

    import QtQuick 1.0

    Rectangle {
    width: choose_shitzu.width; height: choose_shitzu.height

    Loader {
    id: mainLoader
    anchors.fill: parent

    MouseArea {
    id: schoose2menu
    x: 162
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "menu.qml";}
    }

    MouseArea {
    id: schoose2name
    x: 0
    y: 272
    width: 78
    height: 44
    onClicked: {mainLoader.source = "naming_pet.qml";}
    }

    MouseArea {
    id: shitzu_next
    x: 191
    y: 178
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2aspin.qml";}

    }

    MouseArea {
    id: shitzu_back
    x: 12
    y: 179
    width: 43
    height: 44
    onClicked: {mainLoader.source = "choose2chiuaua.qml";}

    }

    AnimatedImage { id: choose_shitzu; x: 0; y: 0; width: 240; height: 316;
    source: "Choose Pet (Shih Tzu)" }

    }
    

    }
    @

    Hi to all!

    Here are some of my codes in QML. Its working and the MouseArea(s) are working too. But the thing is, its only overlapping the previous QML and the previous MouseArea(s) is still in the new called QML.

    Please help me. Thanks in Advance

    EDIT: moved to forum Qt Quick, Gerolf



  • i think, you have to close the previous qml.



  • im trying.. and im still looking for a code to close the previous qml.. but i failed.. :(



  • [quote author="eirnanG" date="1308715713"]@ //choose2chiuaua.qml

    Here are some of my codes in QML. Its working and the MouseArea(s) are working too. But the thing is, its only overlapping the previous QML and the previous MouseArea(s) is still in the new called QML.

    Please help me. Thanks in Advance[/quote]

    Your previous MoseArea(s) will still be active as your are not making then invisible or reducing the size to zero.

    @http://doc.qt.nokia.com/4.7-snapshot/qml-loader.html#source-prop@
    According to the doc, setting new source should unload previous item and load the new one. If this does not happen then its a bug.

    }



  • Maybe try adding the enabled property to the MouseAreas or to the Loader and then enabled: false the once you don't need??
    Not sure if it works with those elements though...



  • cmer4 and Vijay thanks!! it works..
    it makes me enjoy more in using QT :)



  • you are welcome. So only thing you did was making MouseArea disabled when you don't need them?



  • yea.. it helps a lot, because we're using almost 20 QMLs.... :)


Log in to reply
 

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