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

QTreeView click problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 599 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.
  • M Offline
    M Offline
    MLGDN
    wrote on 25 Dec 2017, 08:51 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 25 Dec 2017, 09:57 last edited by
      #2

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

      1 Reply Last reply
      1

      1/2

      25 Dec 2017, 08:51

      • Login

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