[PyQt] Model copying

Jorge Tornero - Listas jtorlistas at gmail.com
Fri Dec 13 13:01:27 GMT 2013


Thank you for reading this:

I' ve populated a tablewidget and I want to reuse its (internal) model 
to pouplate a qcombobox . So far, I've done:

1) I create a qtableview and a model for it as newModel=tableWidget.model()
2) I set the model of my combo the same as the qtableview
3) I set combobox's view as the qtableview.

Of course it works... but when I remove a item in the "original" 
tablewidget, it gets removed from the combo. I think it's amatter of 
assignmente, etc... but I've tried with copy() and deepcopy() and it 
throws an error:

TypeError: PyQt4.QtCore.QAbstractTableModel represents a C++ abstract 
class and cannot be instantiated

Any idea on how to proceed?

Best regards,

Jorge Tornero


More information about the PyQt mailing list