QStyledItemDelegate - strange behavior of checkbox



  • 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


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.