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. I need a Unique Index in QTreeView or something like that
Forum Updated to NodeBB v4.3 + New Features

I need a Unique Index in QTreeView or something like that

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 671 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Im building a QTreeView with a QAbstractItemModel. And because i want to use a Database for the TreeView im interested in how the index in the TreeView works. I found out that every parent has childs and every child has a row, but is there a Index or something or a Unique ID? I want to append a child to a parent that i get from a Database. It would be easy if i have a Database with 2 Columsn. 1 Column the Parent (ID or Index or something) and 1 Column for the Name. The Problem is that if i add a new Entry in the Database i need to jump to the parent at the end of a Loop, if i build a Model. You now what i mean? Is there a Possibility to jump to an parent or an child at the end of a Loop?

    raven-worxR 1 Reply Last reply
    0
    • ? A Former User

      Im building a QTreeView with a QAbstractItemModel. And because i want to use a Database for the TreeView im interested in how the index in the TreeView works. I found out that every parent has childs and every child has a row, but is there a Index or something or a Unique ID? I want to append a child to a parent that i get from a Database. It would be easy if i have a Database with 2 Columsn. 1 Column the Parent (ID or Index or something) and 1 Column for the Name. The Problem is that if i add a new Entry in the Database i need to jump to the parent at the end of a Loop, if i build a Model. You now what i mean? Is there a Possibility to jump to an parent or an child at the end of a Loop?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Fuel
      do you mean something like QModelIndex::parent() ??

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        A QModelIndex has a row, column and a parent right? Can i save it to a Database?

        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