diff --git a/tabulous/_qt/_table/_base/_delegate.py b/tabulous/_qt/_table/_base/_delegate.py index 45cb4d0..ed83fc3 100644 --- a/tabulous/_qt/_table/_base/_delegate.py +++ b/tabulous/_qt/_table/_base/_delegate.py @@ -4,7 +4,7 @@ from qtpy.QtCore import Qt from ._table_base import QBaseTable -from ._line_edit import QCellLiteralEdit +from ._line_edit import QCellLiteralEdit, QCellLineEdit from tabulous._magicgui._timedelta import QTimeDeltaEdit @@ -77,7 +77,9 @@ def createEditor( td.setValue(value) return td elif dtype == "object": - raise NotImplementedError("Cannot edit cell of object dtype.") + line = QCellLineEdit(parent, qtable_view.parentTable(), (row, col)) + line.setFont(font) + return line else: line = qtable_view._create_eval_editor(moveto=(row, col)) line.setFont(font) diff --git a/tabulous/_qt/_table/_base/_line_edit.py b/tabulous/_qt/_table/_base/_line_edit.py index 20e6b4c..7d83468 100644 --- a/tabulous/_qt/_table/_base/_line_edit.py +++ b/tabulous/_qt/_table/_base/_line_edit.py @@ -299,6 +299,9 @@ def eventFilter(self, o: QCellLiteralEdit, e: QtCore.QEvent): return True return False +class QCellLineEdit(_QTableLineEdit): + def _is_text_valid(self) -> bool: + return True class QCellLiteralEdit(_QTableLineEdit): """Line edit used for evaluating cell text."""