Creating a Tree Model from a QStandardModel
Hi,
I need to create a tree model from an other model (QStandard Model).
The data is present in the QStandard model, the requirement is to create a tree in such a way that one of the columns of QStandard model is root of that tree.
Please guide to how can i do it.
If some sample code or some reference is provided, it would be great.
Regards,
GK
Re: Creating a Tree Model from a QStandardModel
Re: Creating a Tree Model from a QStandardModel
Quote:
Originally Posted by
kaushal_gaurav
I need to create a tree model from an other model (QStandard Model).
Luckily there is "an example usage of QStandardItemModel to create a tree" in QStandardItemModel docs.
Quote:
The data is present in the QStandard model, the requirement is to create a tree in such a way that one of the columns of QStandard model is root of that tree.
Could you elaborate? How could one column be a root?
Re: Creating a Tree Model from a QStandardModel
By one column has to be root i mean that...
The hierarchy goes as follows///
One of the column is Manufacturer... it would have many types of devices.. and then each type of device would have further substypes... for eg....
Manufacturer-----Device--------- Product
---------------------------------------------------------
HP-----------------Printer------------Inkjet
----------------------------------------Laser
--------------------Camera-----------Digital
----------------------------------------Analog
Cannon-------------Printer------------Inkjet
----------------------------------------Laser
---------------------Camera-----------Digital
----------------------------------------Analog
Other----------------Printer------------Inkjet
------------------------------------------Laser
----------------------Camera-----------Digital
------------------------------------------Analog
So here Manufacturer column is root so when user selected an item from Manufacturer column then the Devices column is branched and so on...
It is similar to MAC Finder window.....
I need to create a Tree Model and i am totally blank on how to proceed.......
Please help
GK