Any help or suggestions from Qt experts please ??
Any help or suggestions from Qt experts please ??
Thanks :-)
QTreeView::setRootIsDecorated() might help. It is true by default. Did you set it to false somewhere?
The visibility of the tree expansion decoration ⊞ is controlled by the number of children the item has. No children, no indicator. You do not create the children until the first time the data() function is called (on any item for any reason, almost certainly not right). If the view calls hasChildren() or rowCount() before it calls data() then you have no children hence no indicator.
Your model is peculiar to say the least. If you want all the 5000 top level items to have default children then simply create them at construction time and return the vector count() for rowCount().
No where d_stranz.
Added after 15 minutes:
hmm.. I have a problem with model default implementation (http://www.qtcentre.org/threads/6303...ems?highlight=).
I have a lots of data (millions of rows, probably more than 70 million items which a view can not handle in single page).
hence i have considerable amount of delay (rowCount() calls for all the top level items initially). So decided not to have any calculations rowCount().
if I want to build tree with tree items which is taking considerable amount time as data is in billions.
I can not go for lazy population because I will have problem with scroll bar size then(scroll size will be adjusted as we load data).
So I am looking for a way where I can load data dynamically(with correct scroll bar size at first time only), Any suggestions ??
With the above approach I felt some how I did it but not able to see plus sign even though I could see children with double click on parent.
Thanks a lot.
Last edited by prasad_N; 25th July 2015 at 07:22.
Thanks :-)
Probably because the chronology of events following the double-click results in the model reporting that the parent you clicked on has children (i.e. rowCount() > 0), and so the tree expands.With the above approach I felt some how I did it but not able to see plus sign even though I could see children with double click on parent.
Face it, you are trying to use the model/view architecture in a way it wasn't designed for. In order for the parent items at any level in the tree to display arrow icons, they have to report that they have a non-zero row count. In order for the scrollbars to work correctly, the number of top-level items must be known at the time the tree is laid out in response to a change in the model. And all of this depends on the model correctly reporting all the details the tree view needs to lay itself out. By lying to the tree view about the size of the model, you are preventing it from working as designed and you end up with undesirable behaviour.
I've been reading your posts since you first started them a while back, and I can't help but think that whoever is putting together the specification for the code you are writing doesn't really understand what they are asking for. In practical terms, no one will ever scroll through a list of 70 million items, whether it is in a table or tree or whatever. So to start a user interaction with the premise that they will do a search and then drill down through 70 million answers to get to the subset they are really interested in not practical. Humans are not very good at seeing details in a sea of similar things. Giving them a huge list of things, all of which look basically the same, and expecting them to find the one they are most interested in will be a very tedious and frustrating experience. Faced with that kind of interface, I think users would quickly abandon the software for something less unwieldy.
On the other hand, humans are very good at detecting patterns and comparing images. Images are a great way of condensing a huge amount of information into something a human can look at and compare one result against another.
So instead of building a list of 70 million things, are there ways to display these results as some form of image or plot? Take a one-dimensional list and turn it into something where similar results are grouped together in 2D and things that are not so similar stand out? Selecting something from that image builds the tree based on items in the vicinity of the selection and lets the user drill down from there.
I don't know what field you are working in. I would guess it is possibly bioinformatics or demographics, but maybe not. Regardless, there has to be a more user-friendly way to present your results than what you are doing now.
Hmm.. its true.
glad to hear this :-)
Its true, may be I need to change my design & think in another way. But from my old posts I really did not get
1. why model should call all the top level items rowCount(), if it is for scroll bar its enough get to know rowCount() of invalid index. and get other items rowCount() when needed/scroll.
2. why should model call all the top level items rowCount() when we have variable headers.
I have already posted for the above problems. We have provided such a great MVC architecture, but not able to handle more data because of some reasons, hope they will get fixed in future version.
Thanks alot.
Thanks :-)
Bookmarks