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. QTreeView click problem
Qt 6.11 is out! See what's new in the release blog

QTreeView click problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 797 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.
  • M Offline
    M Offline
    MLGDN
    wrote on last edited by
    #1

    I use QTreeview with QStandardItemModel. for some reason I used a stylesheet to hide branch image, and set QStandardItem Icon with mine. I connect clicked(QModelIndex) signal with sltOnItemClicked(QModelIndex index) function to solve the expand and collapse problem. Displaying checkboxes is also needed, I do not use follow code connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onItemChanged(QStandardItem*)));, as it caused my program crash, so I deal it in sltOnItemClicked(QModelIndex index) function. my problem is how to know the mouse click on the checkbox, then I can deal with these issues separately.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I think you can hookup to QAbstractItemModel::dataChanged
      and check the "checkbox" state there.

      1 Reply Last reply
      1

      • Login

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