14 #include <qstyleditemdelegate.h>
18 : QStyledItemDelegate(parent), myAsStringList(asStringList), myTrimEmpty(trimEmpty)
28 QTextEdit* edit =
new QTextEdit(parent);
29 edit->setAcceptRichText(
false);
37 QTextEdit* edit = qobject_cast<QTextEdit*>(editor);
42 edit->setPlainText(
index.model()->data(
index, Qt::EditRole).value<QStringList>().join(
"\n"));
44 edit->setPlainText(
index.model()->data(
index, Qt::EditRole).toString());
47 QStringList
convert(
const QString& source,
bool trimEmpty)
50 for (QString
line : source.split(
"\n"))
52 if (!
line.isEmpty() || !trimEmpty)
62 QTextEdit* edit = qobject_cast<QTextEdit*>(editor);
69 model->setData(
index, edit->toPlainText());