[PyQt] PyQt5.6 with Python 3.5 Crash
Rathinam Signup
tfa.signup.test at gmail.com
Fri May 19 13:57:38 BST 2017
Hi Florian,
Thanks again for the response.
>Wouldn't it be easier to just use a QStandardItemModel with
>QStandardItems
Maybe. But I developed this code based on the simpletreemodel provided with
PyQt Examples>Item Views. So continued with it.
>Does your model call begin* and end* appropriately?
I haven't used InsertChild at all in my code. I always add beginInsertRows
before append child and endInsertRows after it's appended. In this line,
the app is crashing.
>This seems wrong, your leaf items dont have any children.
I intentionally returned True. When the user expands the item I connect
with the server and check for children and if it doesn't have any children,
No children text is added to the tree.
Do you know how can I view the crash report in PyQt? Thanks
Hi,
>
> > In the documentation of pytest-qt it's said that we need to add some
> items
> > and then test. Does it mean after appending few children at the root
> level?
>
> Basically the modeltester tries to check if the model behaves correctly
> with whatever it does. It can test quite a few things without any
> modifications to the model, but ideally you should start the modeltester
> and then do various modifications to the model. In my code, I have
> various test cases for the model, and simply also activate the
> modeltester for all of them.
>
> Some comments about the code below:
>
> > class TreeItem(object):
> > def __init__(self, resource_id, name, parent_id, root_id,
> > parent=None, type="Folder"):
> > self.resource_id = resource_id
> > self.parent_id = parent_id
> > self.root_id = root_id
> > self.parentItem = parent
> > self.name= name
> > self.nodeType=type
> > self.childItems = []
>
> Wouldn't it be easier to just use a QStandardItemModel with
> QStandardItems?
>
> > def insertChild(self, pos, item):
> > self.childItems.insert(pos, item)
> >
> > def appendChild(self, item):
> > self.childItems.append(item)
> >
> > def removeChild(self, item):
> > self.childItems.pop(0)
>
> Does your model call begin* and end* appropriately?
>
> > class TreeModel(QAbstractItemModel):
> > [...]
> >
> > def hasChildren(self,index):
> > return True
>
> This seems wrong, your leaf items dont have any children.
>
> Florian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170519/bbc4092c/attachment-0001.html>
More information about the PyQt
mailing list