Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Make a tree in Qml with Menu
QtWS25 Last Chance

Make a tree in Qml with Menu

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 342 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cosmoff
    wrote on 24 Sept 2019, 13:10 last edited by cosmoff
    #1

    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

    O 1 Reply Last reply 24 Sept 2019, 13:25
    0
    • C cosmoff
      24 Sept 2019, 13:10

      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

      O Offline
      O Offline
      ODБOï
      wrote on 24 Sept 2019, 13:25 last edited by
      #2

      @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

      C 1 Reply Last reply 24 Sept 2019, 13:40
      0
      • O ODБOï
        24 Sept 2019, 13:25

        @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

        C Offline
        C Offline
        cosmoff
        wrote on 24 Sept 2019, 13:40 last edited by
        #3

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

        1 Reply Last reply
        0

        1/3

        24 Sept 2019, 13:10

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved