[Qt-interest] QTable model with designer GUI

emmanuel_mayssat at lynceantech.com emmanuel_mayssat at lynceantech.com
Tue Sep 14 04:15:00 CEST 2010


Hello,

I designed my GUi using QT designer.
In it I have a table(self.conditionTable) , and a few buttons (add, remove).
I already wrote some code for the widget (i.e def on_addPushButton_pressed ...)
Question: How can I attached to the table a model?

If I do a self.conditionTable.setModel(myModel) in ConditionTableWidget.__init__, I get a 
 
 File "conditionTableWidget.py", line 44, in <module>
    widget=ConditionTableWidget()
  File "conditionTableWidget.py", line 21, in __init__
    self.tableWidget.setModel(self.tableWidgetModel)
TypeError: QTableWidget.setModel() is a private method

where should I associate the view to the model?
Regards,

PS: extra points for some pyQt4 code ;-)
-- 
Emmanuel



More information about the Qt-interest-old mailing list