Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Make a tree in Qml with Menu



  • Hello everybody,

    I try to make a dynamic tree at 3 level with the component Menu ( I did not find better), but It does not work
    this is my code :

    Button {
            id: fileButton
            text: "File"
            onClicked: menu.open()
            //Component.onCompleted: menu.open()
    
            ListView{
                model : ["1", "2", "3"]
    
    
                delegate : Button{
                    id : menu
                    text : modelData
                    onClicked: menu2.open()
                    Menu{
                        y: fileButton.height
                        id : menu2
                        ListView{
                            model : ["a", "b", "c"]
    
    
                            delegate : Button{
                                y: menu.height
                                id : menu3
                                text : modelData
                            }
                        }
    
                    }
                }
    
            }//end listView
    
        }
    
    

    I am working on Qt 5.9
    do you have an idea to resolve my problem ?
    thanks



  • @cosmoff hi
    its hard to understand what you are trying to achive, can you show an mockup of what you need ?

    note there is a TreeView QML type



  • Yes, I Would like something like that :
    Tree.jpg


Log in to reply