spinetoolbox.widgets.custom_delegates

Custom item delegates.

author:
  1. Marin (KTH)
date:

1.9.2018

Module Contents

Classes

ComboBoxDelegate
LineEditDelegate A delegate that places a fully functioning QLineEdit.
CheckBoxDelegate A delegate that places a fully functioning QCheckBox.
ForeignKeysDelegate A QComboBox delegate with checkboxes.
class spinetoolbox.widgets.custom_delegates.ComboBoxDelegate(items)[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

createEditor(self, parent, option, index)[source]
paint(self, painter, option, index)[source]
setEditorData(self, editor, index)[source]
setModelData(self, editor, model, index)[source]
updateEditorGeometry(self, editor, option, index)[source]
_finalize_editing(self, editor)[source]
class spinetoolbox.widgets.custom_delegates.LineEditDelegate[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

A delegate that places a fully functioning QLineEdit.

parent

either data store or spine datapackage widget

Type:QMainWindow
data_committed[source]
createEditor(self, parent, option, index)[source]

Return CustomLineEditor.

setEditorData(self, editor, index)[source]

Init the line editor with previous data from the index.

setModelData(self, editor, model, index)[source]

Send signal.

class spinetoolbox.widgets.custom_delegates.CheckBoxDelegate(parent, centered=True)[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

A delegate that places a fully functioning QCheckBox.

parent

either toolbox or spine datapackage widget

Type:QMainWindow
centered

whether or not the checkbox should be center-aligned in the widget

Type:bool
data_committed[source]
createEditor(self, 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(self, painter, option, index)[source]

Paint a checkbox without the label.

editorEvent(self, 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(self, editor, model, index)[source]

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

get_checkbox_rect(self, option)[source]
class spinetoolbox.widgets.custom_delegates.ForeignKeysDelegate[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

A QComboBox delegate with checkboxes.

parent

spine datapackage widget

Type:SpineDatapackageWidget
data_committed[source]
_close_editor(self, editor, index)[source]

Closes editor. Needed by SearchBarEditor.

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

Return editor.

updateEditorGeometry(self, editor, option, index)[source]
setModelData(self, editor, model, index)[source]

Send signal.