[PyQt] QSqlRelationalTableModel and section locators

Scott Frankel frankel at circlesfx.com
Wed Feb 3 05:26:33 GMT 2010


Hi all,

Are there any other ways to specify a table model's section position,  
other than by using the db schema's column order?

I'm referring to methods like:

bool QSqlQueryModel::setHeaderData ( int section, Qt::Orientation  
orientation, const QVariant & value, int role = Qt::EditRole )

With the method's "int section" arg, if table columns in my db schema  
get reordered, my code breaks.  For example, today this line works  
properly:

	self.theModel.setHeaderData(1, QtCore.Qt.Horizontal,  
QtCore.QVariant("Name"))

If the table's name field changes from the 1st to the 3rd column  
during an update, then the statement reads incorrect data.

Thanks in advance!
Scott


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100202/fe77f6bd/attachment.html>


More information about the PyQt mailing list