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. Add checkbox to toolbar button

Add checkbox to toolbar button

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.5k 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.
  • R Offline
    R Offline
    rizoritis
    wrote on last edited by
    #1

    Hello,

    I have a custom vertical QToolBar in my application with custom buttons that I set images for. Instead of changing the image appearance for toggle buttons I would like to add a checkbox to the upper right-hand corner of each button to be checked when activated and unchecked when deactivated. I searched online to see if there were any examples or how to implement this, but came out unsuccessful. Does anyone know of a simple way to place a checkbox in the upper right corner of a button in my toolbar?

    Thanks!

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi, You might just need to overwrite the default paintEvent and do it your self. there is a standard "checked" for a simple checkbox in front of the button.
      Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0
      • jazzycamelJ Offline
        jazzycamelJ Offline
        jazzycamel
        wrote on last edited by
        #3

        The "Commontk":http://www.commontk.org/ widget set includes a checkable button that might be adapted to your purposes:

        !http://www.commontk.org/images/5/53/CtkCheckablePushButton.png(ctkCheckablePushButton)!

        The api is "here":http://www.commontk.org/docs/html/classctkCheckablePushButton.html and the source is "here":https://github.com/commontk/CTK/tree/master/Libs/Widgets.

        Hope this helps ;o)

        For the avoidance of doubt:

        1. All my code samples (C++ or Python) are tested before posting
        2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
        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