Use custom signals to record previous name

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li
2025-03-27 17:13:38 +08:00
parent 11a0dbf810
commit a2e44c0ef7
8 changed files with 18 additions and 44 deletions

View File

@ -397,6 +397,7 @@ void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
// Prevent instance names longer than 128 chars
text.truncate(128);
if (text.size() != 0) {
emit textChanged(model->data(index).toString(), text);
model->setData(index, text);
}
}

View File

@ -33,6 +33,9 @@ class ListViewDelegate : public QStyledItemDelegate {
void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
signals:
void textChanged(QString before, QString after) const;
private slots:
void editingDone();
};