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. Model/view Combobox wrong index

Model/view Combobox wrong index

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k 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.
  • L Offline
    L Offline
    lloydqt
    wrote on last edited by
    #1

    Hi,
    I am using QComboBox in Model/View manner. QStandardItemModel is used as the model, and it is used like a checkable tree. using the QStandardItemModel::setItem() call, root nodes are added and using QStandardItem::setChild() call child nodes to the root nodes are added. I am catching the activated(int) signal of QComboBox (could not find a better signal), but it returns a wrong index.

    As an example lets say I have 2 root nodes and there is 4 child nodes in first root node, and 2 child nodes in 2nd root node. If I click 3nd item of the 1st root node, the index returned is 2 (I understand that index starts from 0) instead of 3!. What could be the reason, is there a better way to handle this?

    Thanks,
    Lloyd

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goblincoding
      wrote on last edited by
      #2

      Do you have any code for us to look at? I for one find it a bit tricky to figure out exactly what you mean :)

      http://www.goblincoding.com

      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