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. get an index from an item (for a QtreeView)
Forum Updated to NodeBB v4.3 + New Features

get an index from an item (for a QtreeView)

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 450 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.
  • jerome_isAviableJ Offline
    jerome_isAviableJ Offline
    jerome_isAviable
    wrote on last edited by jerome_isAviable
    #1

    I have a QtreeView, and a model from a QAbstractItemModel and a class named "Location" who is my item linked with my model.
    And then, in my model, i try to construct a method named "indexOf(Location *location)" (who is exactly the same function of a QStandardItem named "indexFromItem(QStandardItem *item)" )...
    At this time, i'm locked at just:
    QModelIndex Location_Model::indexOf(Location *location) {
    return createindex(0,0,location);
    }

    the problem is that my row is 0... and then this never give me back the correct index... what i can do for know the row before have the index ?
    could you help me to create this indexOf ?

    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