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. [SOLVED] Label supports mouse click event?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Label supports mouse click event?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 921 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.
  • A Offline
    A Offline
    av2306
    wrote on last edited by
    #1

    Hi,

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

    If not, what is the best alternative for this?

    Thanks.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasRicardo
      wrote on last edited by
      #2

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

      **Sorry for my english :)

      PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        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