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. How do I modify the data of a node in a qtreeview

How do I modify the data of a node in a qtreeview

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 642 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
    canid
    wrote on last edited by canid
    #1

    How do I modify the data of a node in a qtreeview?thanks

    JonBJ 1 Reply Last reply
    0
    • C canid

      How do I modify the data of a node in a qtreeview?thanks

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @canid
      What do you mean? Your QTreeView has an associated model() (https://doc.qt.io/qt-5/qabstractitemview.html#model), that is where the data comes from and needs to be modified. Or are you asking about how you do it interactively from the treeview, or what?

      C 1 Reply Last reply
      2
      • JonBJ JonB

        @canid
        What do you mean? Your QTreeView has an associated model() (https://doc.qt.io/qt-5/qabstractitemview.html#model), that is where the data comes from and needs to be modified. Or are you asking about how you do it interactively from the treeview, or what?

        C Offline
        C Offline
        canid
        wrote on last edited by canid
        #3

        @jonb
        I found that I could only modify the data in a single column of a row, and there was no way to modify the multi-column data in a row of the treeview

        JKSHJ 1 Reply Last reply
        0
        • C canid

          @jonb
          I found that I could only modify the data in a single column of a row, and there was no way to modify the multi-column data in a row of the treeview

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          @canid said in How do I modify the data of a node in a qtreeview:

          I found that I could only modify the data in a single column of a row, and there was no way to modify the multi-column data in a row of the treeview

          Get the QModelIndex of the cell that you want to modify (for example, when you click on a cell the QAbstractItemView::clicked(QModelIndex) signal is emitted)

          Once you have the index, call QAbstractItemModel::setData(QModelIndex, QVariant)

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          3

          • Login

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