impr: able to edit chart/score when original value is invalid

This commit is contained in:
2023-09-06 01:17:37 +08:00
parent 1955a7963a
commit 3f42be3212
2 changed files with 27 additions and 21 deletions

View File

@ -152,15 +152,15 @@ class ChartDelegate(TextSegmentDelegate):
def createEditor(
self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex
) -> ChartSelectorDelegateWrapper:
editor = ChartSelectorDelegateWrapper(parent)
editor.setWindowFlag(Qt.WindowType.Sheet, True)
editor.setWindowFlag(Qt.WindowType.FramelessWindowHint, True)
if isinstance(self.getChart(index), Chart):
editor = ChartSelectorDelegateWrapper(parent)
editor.setWindowFlag(Qt.WindowType.Sheet, True)
editor.setWindowFlag(Qt.WindowType.FramelessWindowHint, True)
editor.setText(self.getChart(index))
editor.move(parent.mapToGlobal(parent.pos()))
editor.accepted.connect(self._commitEditor)
editor.rejected.connect(self._closeEditor)
return editor
editor.move(parent.mapToGlobal(parent.pos()))
editor.accepted.connect(self._commitEditor)
editor.rejected.connect(self._closeEditor)
return editor
def updateEditorGeometry(self, editor: QWidget, option, index: QModelIndex) -> None:
editor.move(editor.pos() + option.rect.topLeft())