Unsolved Cannot read property of null warnings when scrolling TreeView
-
Hi
I have aTreeView
which uses aQSortFilterProxyModel
from C++. Inside the delegate, I use themodel.[role]
syntax instead ofstyleData.value
to get the model data because I display several different model roles inside theitemDelegate
for the only column in the view.Although the data is displayed correctly, I get warnings like the following:
TypeError: Cannot read property 'title' of null
These warnings only appear when I scroll the view, probably when new delegates are being instantiated.
The question therefore is why these warnings are generated, since the model is set, exists and is never modified.
To avoid the warnings, I use something like:
Text { text: model ? model.title : "" }
But clearly, the above is really only a workaround.
Note that when I use
styleData.value
(assuming the role for that column is set to"title"
), I don't get the warning for that particular role.Surely, this must be a bug of sorts? I can't imagine I must keep doing this
model ? model.A : B
check every time I access a model role inside the delegate...Thanks for any comments you may have on this.
Cheers!