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. QStyledItemDelegate - strange behavior of checkbox
QtWS25 Last Chance

QStyledItemDelegate - strange behavior of checkbox

Scheduled Pinned Locked Moved General and Desktop
model-viewdelegatecheckbox
2 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    dis
    wrote on 31 Mar 2015, 09:43 last edited by
    #1

    Hi,

    i reimplemented paint() method of class QStyledItemDelegate.
    For each index I draw with function painter->drawPixmap() this widgets in one row:
    QLabel QCheckBox QLabel

    The problem occurs when I try to change the value of a checkbox in view.
    QCheckBox value changes when clicking on the first QLabel and not the actual QCheckBox.
    If the first QLabel omit everything will behave as expected.

    Attaching image for an explanation: Clicking on the red area in image changes the value of QCheckBox.
    Link to image (uploaded on postimg.org)

    Thank you for your ideas

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 31 Mar 2015, 23:29 last edited by
      #2

      Hi and welcome to devnet,

      Since you are painting things yourself, you would also need to handle the mouse interaction yourself. Painting a QCheckBox is not the same has having an actual checkbox widget.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      31 Mar 2015, 09:43

      • Login

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