[SOLVE]Quiting Problem



  • Hi. I rewrite my codes again and i just noticed something.. I guess it was my problem before and I believed I am stuck with this for a while I forgot to check on this..

    I have a mouseArea on exitIcon... this, obviously quits the game..

    but... let's say when I clicked on the playIcon.. this will load another qml file and start the game proper.. but whenever i intentionally click on the spot or area where the exitIcon has been previously positioned.. the MouseArea with Quit function still works.. How would i disable it??

    @ Image{
    id:exitIcon
    x: 12
    y: -183
    fillMode: Image.PreserveAspectFit
    source:"images/menu/exit.png"
    MouseArea{
    anchors.fill: parent
    onClicked: {
    MouseArea.enabled=false
    onExitClicked:Qt.quit()
    }

        }
    }
    

    @



  • hide the mouse area when you click it by changing the visibility of your mousearea after you click it

    @ MouseArea{
    id:exit
    anchors.fill: parent
    onClicked: {
    MouseArea.enabled=false
    onExitClicked:Qt.quit()
    exit.visible = false
    }
    @



  • still not works. :-( i dunno what to do...



  • @MouseArea{
    id:exit
    anchors.fill: parent
    onClicked: {
    MouseArea.enabled=false;
    onExitClicked:Qt.quit();
    MouseArea.visible = false;
    }@

    try this maybe it needs ; on each statement ^^

    i only stated MouseArea.visible = false on every mousearea i click to hide it.



  • I have managed to solve it thanks. I just disable the mouseare for quit button the moment i click on playIcon.. :D


  • Moderators

    Be sure and add [Solved] to the beginning of the thread title! Thanks!


Log in to reply
 

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