[PyQt] Possible QTreeWidgetItem constructor bug

Phil Thompson phil at riverbankcomputing.com
Mon Apr 16 12:47:05 BST 2012


On Mon, 16 Apr 2012 14:46:54 +1200, Glenn Ramsey <gr at componic.co.nz>
wrote:
> If this QTreeWidgetItem constructor is called with a single string
instead
> of a 
> list of strings for the "strings" parameter, then on my system (Win 7,
> Python 
> 2.6.5, Qt 4.7.4, PyQt 4.8.5) it crashes the python interpreter.
> 
> QTreeWidgetItem.__init__ (self, QTreeWidget parent, QStringList strings,
> int 
> type = QTreeWidgetItem.Type
> 
> Shouldn't that cause an Attribute error to be raised?

No. PyQt allows any sequence of strings to be used where a QStringList is
expected - and a string is a sequence of (1 character) strings.

However it shouldn't crash (unless it is a Qt bug). Have you got a
complete test script that demonstrates the problem?

Phil


More information about the PyQt mailing list