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. QTreeWidget Signal itemDoubleClicked Returns QModelIndex?
Forum Updated to NodeBB v4.3 + New Features

QTreeWidget Signal itemDoubleClicked Returns QModelIndex?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 764 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.
  • MiBrM Offline
    MiBrM Offline
    MiBr
    wrote on last edited by
    #1

    I have a QTreeWidget with QTreeWidgetItems or in my case CustomTreeItems and when I use the signal itemDoubleClicked instead of returning a QTreeWidgetItem it returns a QModelIndex. Is this normal behavior?

    CODE:

    def on_double_click_tree(self, currItem):
            print(currItem)
            print("row: ",currItem.row())
            print("data: ",currItem.data())
            print("parent: ",currItem.parent())
    
    self.modemTree.doubleClicked.connect(self.on_double_click_tree)
    
    def on_select_tree_item(self, currItem):
              print(currItem)
    
    self.modemTree.itemClicked.connect(self.on_select_tree_item)
    

    A single click returns a CustomTreeItem (QTreeWidgetItem) which is expected, however a double click returns the QModelIndex which is not expected.

    OUTPUT:
    0_1500567823114_92782410-0577-4d3f-a78b-0eceec99bdfb-image.png

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Fuel
      wrote on last edited by
      #2

      Yes, but you can access the Data by using the method data() from the QModelIndex

      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