[PyQt] QSqlQueryModel works but QSqlTableModel doesn't work

Ivan Coronado icoronado at epcge.com
Tue Mar 4 14:08:59 GMT 2008


Hello, I'm trying to load one table in a QSqlTableModel. The columns loads with no problem, but the data doesn't load. When I use the select() method it returns False. The same table load Ok with QSqlQueryModel. I haven't problems with the others tables.

----------------------------------------------------------------
class dlgChild(QtGui.QWidget):
    def __init__(self,parent=None):
        QtGui.QMainWindow.__init__(self,parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        
        self.tb= QtSql.QSqlTableModel()   
        self.tb.setTable("condicionesref") #if I change the table works ok
        self.tb.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
        self.tb.select() #returns False
        print self.tb.rowCount() #returns 0
        self.ui.tvOpcionesReglas.setModel(self.tb)
        self.ui.tvOpcionesReglas.show() #only show the column names
-----------------------------------------------------------------

Thanks for the help
 
-------------------------------------------------------------
Iván Coronado
IT Manager
icoronado at epcge.com
943 82 00 10
Engine Power Components Group Europe
 



More information about the PyQt mailing list