vvim / BT_deelnemers

First try out for the Buurtijd software project
0 stars 0 forks source link

QTextEdit does not get saved correctly in the database? #18

Open vvim opened 7 years ago

vvim commented 7 years ago

after saving a QTextEdit to the database, it might reload and show only an empty field

What went wrong?

see local project coding/0-qt-examples/qq21-datawidgetmapper/20170904-wim-sqlwidgetmapper/ --> we changed the QTextEdit to a QPlainTextEdit.

Apparently, the QTextEdit tried to save HTML to the database, but could not find a valid HTML-code. So it saved HTML-code that only show an empty TextEditBox...

other way to solve it: https://forum.qt.io/topic/76021/field-does-not-get-saved-correctly/4

model->setData(model->index(row, model->fieldIndex("model")), ui.model_txt->toPlainText());
model->submitAll();

but then better to use a QPlainTextEdit from the start, I guess