[PyQt] Problem using QTreeWidget.setModel on Windows XP.

Phil Thompson phil at riverbankcomputing.com
Sat Feb 9 09:56:42 GMT 2008


On Friday 08 February 2008, Joon-Cheol Park wrote:
>  Hello,
>
> I am using PyQt on Windows XP and Ubuntu.
> My environment is python 2.5 and Qt4.3.3 OpenSource Edition and PyQt GPL
> 4.3.3.
>
> I found an unexpected behaviour in Window XP.
> This code is Okay in Ubuntu.
>
>  code:
> class PluginSettingDialog(QtGui.QDialog):
>     def __init__(self, parent=None):
>         QtGui.QDialog.__init__(self, parent)
>         self.ui = Ui_PluginSettingDialog()
>         self.ui.setupUi(self)
>         ...
>         self.ui.treeWidget.setEditTriggers(
>                         QtGui.QAbstractItemView.NoEditTriggers)
>         self.ui.treeWidget.setRootIsDecorated(False)
>         self.ui.treeWidget.setAlternatingRowColors(True)
>         self.ui.treeWidget.setModel(self.createModel())
>
>
> $ /cygdrive/c/Python25/python pluginsetting.py
> ...
> Traceback (most recent call last):
>   File "pluginsetting.py", line 86, in <module>
>     dialog = PluginSettingDialog()
>   File "pluginsetting.py", line 24, in __init__
>     self.ui.treeWidget.setModel(self.createModel())
> AttributeError: QTreeWidget.setModel is a private method

That's the correct behaviour. If it "works" under Ubuntu then it's not the 
version you think it is.

Phil


More information about the PyQt mailing list