PDA

View Full Version : Data from TableModel and into Text Edit



Nefastious
15th September 2009, 10:12
Hi guys,

I'm wondering how to copy the data on a field of a QSqlTableModel into a TextEdit. Any ideas? Please post some code.

Thanks in advance,
:)

SudaNix
16th September 2009, 02:36
try like this :


QSqlTableModel model;
model.setTable("employee");

// to get the value of the field "name" in the 4th record (also you can loop for all the records):
QString name = model.record(4).value("name").toString();

textEdit->append(name);