[PyQt] PyQt - How to preload values to a QTableView

Aaron Digulla digulla at hepe.com
Mon Oct 13 13:25:24 BST 2008


Quoting Anil <anilet at gmail.com>:

> bool QSqlRelationalTableModel::setData ( const QModelIndex & index, const
> QVariant & value, int role = Qt::EditRole ) 


I think you should use setData(). I haven't used setModelData()  
before. The usual way is like this:

- Create a new row
- Use setData() to prefill some fields (don't do this inside of  
setData() but at the place where you add the extra row!)
- Wait for the user to edit the rest of the row
- Commit the new row.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/



More information about the PyQt mailing list