Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeview with QStandardItemModel
Forum Updated to NodeBB v4.3 + New Features

QTreeview with QStandardItemModel

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 3.2k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Shiv
    wrote on last edited by Shiv
    #1

    I would like to create treeview using qstandarditem model.The treeview should be in the following format(Like a windows explorer tree).Single column UsersList->UserDEPT1->UsersName .Under userlist all dept should be added under each dept user name to be added.I have tried with QTreeviewWidget but i want to implement it with a model.I am stuck any help is appreciated

    1 Reply Last reply
    0
    • A Offline
      A Offline
      asanka424
      wrote on last edited by
      #2

      Can you post an image of your desired outcome?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Shiv
        wrote on last edited by Shiv
        #3

        Its almost similar to the QT IDE class view tree or the project tree in some cases check boxes are required .

        1 Reply Last reply
        0
        • A Offline
          A Offline
          asanka424
          wrote on last edited by
          #4

          where do you stuck? can you explain more.

          1 Reply Last reply
          0
          • Ni.SumiN Offline
            Ni.SumiN Offline
            Ni.Sumi
            wrote on last edited by
            #5

            Hi @Shiv ,

            Is something like this, are you trying?

            • -User  //Parent
                  +UserDept1 //child
                  +UserDept2 //Child
                  -USerDept3 //child
                           userName1//Grandchild
                           username2//Grandchild
                           userName3//Grandchild
              
            1 Reply Last reply
            0
            • S Offline
              S Offline
              Shiv
              wrote on last edited by Shiv
              #6

              Hi @Ni-Sumi , Yes Exactly .
              Hi @asanka424 I am stuck in implementing with a qstandarditem model.I will explain the whole context all data is present in the database firstly i have to load the user list with their corresponding dept.Whenever user is selected I have to fetch the other info of the user for editing updating and other activities.So every time i need to update the tree with the changes take place and any new entry i have to add the details to the tree.Hope I have explained the context.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Shiv
                wrote on last edited by
                #7

                Hi all I have got an example and i am working on it to achieve my custom model structure.
                http://doc.qt.io/qt-5/qtwidgets-itemviews-editabletreemodel-example.html

                1 Reply Last reply
                0

                • Login

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