iblqt.widgets.CheckBoxDelegate

class iblqt.widgets.CheckBoxDelegate[source]

Bases: QStyledItemDelegate

A custom delegate for rendering checkboxes in a QTableView or similar widget.

This delegate allows for the display and interaction with boolean data as checkboxes.

displayText(value, locale)[source]

Return an empty string to hide the text representation of the data.

Parameters:
  • value (Any) – The value to be displayed (not used).

  • locale (Any) – The locale to be used (not used).

Returns:

An empty string.

Return type:

str

editorEvent(event, model, option, index)[source]

Handle user interaction with the checkbox.

Parameters:
  • event (QEvent) – The event that occurred (e.g., mouse click).

  • model (QAbstractItemModel) – The model associated with the view.

  • option (QStyleOptionViewItem) – The style option containing the information needed for handling the event.

  • index (QModelIndex) – The index of the item in the model.

Returns:

True if the event was handled, False otherwise.

Return type:

bool

paint(painter, option, index)[source]

Paints the checkbox in the view.

Parameters:
  • painter (QPainter) – The painter used to draw the checkbox.

  • option (QStyleOptionButton) – The style option containing the information needed for painting.

  • index (QModelIndex) – The index of the item in the model.

Return type:

None