Hi all, I am having some issues with QTreeView where I populates the 
information from another model.

While trying to perform the selection within the tree view, it is suppose 
to be returning me the full path of the selection. However for some 
reasons, there is always a 'NoneType' object/ something in which it will 
returns me 2 items - the selection and a None.

For example, if I have the following tree:
* ObjectA
** ObjectB
*** ObjectC

# And selected ObjectC, the full path should be - |ObjectA|ObjecBA|ObjectC 
but instead I got |None|ObjectA|ObjecBA|ObjectC


One way that I have rectified this problem is using `try... except <either 
Attribute or TypeError>` in the selectionChanged connection for the tree 
view and for the displaying of data in the model where it checks if the 
role equates to `QtCore.Qt.DisplayRole`.

About the latter - Correct me if I am wrong, but doesn't 
QtCore.Qt.DisplayRole valid only if there are characters/strings in the 
field? If so, it should not be deriving the empty values, right?

This is the script - https://pastebin.com/xTavZfhP
(I apologize in advance that the code may not work on a typical maya scene 
for some portions within are custom stuff used. Also I have listed out the 
error portions, search using #>>>)


Appreciate for any insights!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4248b8a9-d0b2-4941-9820-cec6db96a5e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to