[SOLVED] Label supports mouse click event?



  • Hi,

    I need a mouse click event on label. Will it support?

    If not, what is the best alternative for this?

    Thanks.



  • @
    Label {
    text: "Hello world"
    MouseArea {
    anchors.fill: parent
    onClick: {
    console.log("click tada");
    }
    }
    }
    @



  • In addition what dasRicardo said, it is not like QLabel. Label is item. MouseArea is typically defined for visible item. So MouseArea can be defined for Label and implement whatever the mouseArea event you would like to have.


Log in to reply
 

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