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. QToolButton that works as a QCheckBox
Forum Updated to NodeBB v4.3 + New Features

QToolButton that works as a QCheckBox

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 686 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.
  • P Offline
    P Offline
    Pippin
    wrote on last edited by
    #1

    Hello,

    I would like to make three QCheckBoxes, each one having its own picture when it's checked and when it's unchecked. I found this on Google but that seems to make all QCheckBoxes work with the same pictures. How can I fix that? Must I use style sheets to accomplish this anyway?

    Not sure if this information is useful, but these QCheckBoxes would be clickable inside a QGraphicsView/QGraphicsScene system. Not inside a simple QMainWindow.

    Thanks a lot for your input!

    raven-worxR 1 Reply Last reply
    0
    • P Pippin

      Hello,

      I would like to make three QCheckBoxes, each one having its own picture when it's checked and when it's unchecked. I found this on Google but that seems to make all QCheckBoxes work with the same pictures. How can I fix that? Must I use style sheets to accomplish this anyway?

      Not sure if this information is useful, but these QCheckBoxes would be clickable inside a QGraphicsView/QGraphicsScene system. Not inside a simple QMainWindow.

      Thanks a lot for your input!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @Pippin
      QToolButtons support images/icons and can also be set checkable.
      If you want them mutual exclusive you can put them into a QButtonGroup.

      Alternatively you can try to do that:

      QCheckBox#MyObjectName::indicator:checked {
         ...
      }
      

      But i guess this won't be accepted by the QSS parser.
      As a workaround you can wrap each checkbox around a container widget and set the object name on it.

      QWidget#MyObjectName > QCheckBox::indicator:checked {
         ...
      }
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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