Unsolved Need help for a TreeView
-
@Eddy I insert it by drag and dropping it.
-
I don't think that will work. Do you see your image after drag and drop?
At least I don't see it over here.please follow the instructions in this link
to show us your picture, otherwise it will be difficult to help you out.Eddy
-
@Eddy Yes I see It (the picture is inside the first message), but It's an image from my computer not from internet so url doesn't work
-
Upload it on internet and share it to us, it will be more easier I think
-
@Fheanor https://www.google.fr/search?q=arborescence&source=lnms&tbm=isch&sa=X&ved=0ahUKEwie0IjOtPbTAhUKJlAKHdl6DaEQ_AUICigB&biw=1920&bih=908#imgrc=IYXrqFXnP7ShfM:
I try with an url but it didn't work so here is a link to a photo on google image that show what I want.
-
Looks like you have to use a
TreeView
withRectangle Delegate
on each line -
@Fheanor Thanks for the answer do you have a code example ?
-
I don't have an example that correspond to your example, but these are two examples of how you can use
Delegate
inside aTreeView
.- You can use the
itemDelegate property
of aTreeView
. This example will change the color of each line:
itemDelegate: Rectangle { color: ( styleData.row % 2 == 0 ) ? "white" : "lightblue" Text { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left text: styleData.value // this points to the role we defined in the TableViewColumn below; which one depends on which column this delegate is instantiated for. } }
- You can also define a special
Delegate
for each column of yourTreeView
like that:
TableViewColumn { id : someColumn role: "someRole" title: someRole delegate : Rectangle { ... } }
Now you have to play with this to draw what you want
- You can use the
-
@Fheanor Ok thanks i'll try I will let you know about my situation. Again thanks for the answers and your time !
-
You are welcome :)
-
@Fheanor Hi, so I didn't manage to make it work, now just forget about the Rectangle thing, I just want to make a Treeview so can you help me ?
-
-
@Fheanor I have some assigning the model value, the example that you gave me the TableViewColumn part work but not the model one, Qt tell me that fileSystemModel doesn't exist. Actually I just want to add some "node" or p"parent" to my Treeview and of course some "children" I suppose it has a link with the model but I don't know how to do it. Hope it is more clear now. Thanks again for your time !
-
@Arkning
This example is in your QtExample folder.
Just open your IDE, click onExamples
and then write :TreeView
. You will see the project. -
@Fheanor I don't have Examples on my IDE... Where should it be on the screen ?
-
-
@Arkning Do you use QtCreator ? Because there are Examples folders in it.
If you don't use it, download and install QtCreator. -
@Fheanor Yes I'm using QtCreator
-
@Arkning This is on the Welcome page of your IDE... There is an Example Button
-
@Fheanor Ok I found it but how can it help me ? I don't see were they create parent or children.