"""Configuration Delegate."""
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QItemDelegate, QDoubleSpinBox
[docs]
class PVConfigurationDelegate(QItemDelegate):
[docs]
def createEditor(self, parent, option, index):
"""Override.
Create and editor based on the cell type
"""
if index.column() == 2:
editor = QDoubleSpinBox(parent)
editor.setDecimals(3)
editor.setMaximum(10)
editor.setMinimum(0)
editor.setSingleStep(0.001)
return editor
[docs]
def setEditorData(self, editor, index):
"""Override.
Set cell data as float.
"""
value = index.model().data(index, Qt.DisplayRole)
editor.setValue(value)