Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can I make the QCheckBox label clickable?
QtWS25 Last Chance

Can I make the QCheckBox label clickable?

Scheduled Pinned Locked Moved Solved General and Desktop
qcheckboxmousepressevent
3 Posts 2 Posters 2.0k Views
  • 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.
  • J Offline
    J Offline
    Jakob
    wrote on 29 Oct 2015, 10:21 last edited by Jakob 12 Oct 2015, 15:30
    #1

    Normally when creating a QCheckBox with a label, the label does not respond to clicks of the mouse.

    Is there a simple way to let the checkbox respond to clicks on the labels instead of only responding to clicks exactly on the checkbox itself?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mostefa
      wrote on 29 Oct 2015, 11:04 last edited by
      #2

      hI @Jakob

      Have you tried to create an inherited class from QCheckbox, and reimplement the mousePressEvent() Virtual Function?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jakob
        wrote on 29 Oct 2015, 13:45 last edited by
        #3

        Nevermind - in the end it turned out the label was modeled as a separate QLabel instead of the text of the QCheckBox. Once I removed the label, and put the text inside the checkbox, I got exactly what I was asking for.

        1 Reply Last reply
        0

        3/3

        29 Oct 2015, 13:45

        • Login

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