spinetoolbox.widgets.custom_delegates

Custom item delegates.

Module Contents

Classes

ComboBoxDelegate

CheckBoxDelegate

A delegate that places a fully functioning QCheckBox.

RankDelegate

A delegate that places a QCheckBox but draws a number instead of the check.

class spinetoolbox.widgets.custom_delegates.ComboBoxDelegate(items)[source]

Bases: PySide6.QtWidgets.QStyledItemDelegate

createEditor(parent, option, index)[source]
paint(painter, option, index)[source]
setEditorData(editor, index)[source]
setModelData(editor, model, index)[source]
updateEditorGeometry(editor, option, index)[source]
_finalize_editing(editor)[source]
class spinetoolbox.widgets.custom_delegates.CheckBoxDelegate(parent, centered=True)[source]

Bases: PySide6.QtWidgets.QStyledItemDelegate

A delegate that places a fully functioning QCheckBox.

Parameters
  • parent (QWiget) –

  • centered (bool) – whether or not the checkbox should be center-aligned in the widget

data_committed[source]
createEditor(parent, option, index)[source]

Important, otherwise an editor is created if the user clicks in this cell. ** Need to hook up a signal to the model.

paint(painter, option, index)[source]

Paint a checkbox without the label.

static _do_paint(painter, checkbox_style_option, index)[source]
editorEvent(event, model, option, index)[source]

Change the data in the model and the state of the checkbox when user presses left mouse button and this cell is editable. Otherwise do nothing.

setModelData(editor, model, index)[source]

Do nothing. Model data is updated by handling the data_committed signal.

get_checkbox_rect(option)[source]
class spinetoolbox.widgets.custom_delegates.RankDelegate(parent, centered=True)[source]

Bases: CheckBoxDelegate

A delegate that places a QCheckBox but draws a number instead of the check.

Parameters
  • parent (QWiget) –

  • centered (bool) – whether or not the checkbox should be center-aligned in the widget

static _do_paint(painter, checkbox_style_option, index)[source]