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/QAbstractItemModel with Checkbox/Text

QTreeView/QAbstractItemModel with Checkbox/Text

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

    I have a QTreeView displaying data that is checkable, but I would like to be able to separate a click on the checkbox and a double click on the text. Double clicking will only check/uncheck the checkbox. I can't quite seem to figure out how to go about doing this. My work around was to create 2 columns and have the checkbox in one column and the text in the second column however this creates a problem where the more children there are the further away the collapse/expand icons with the checkbox are from the text/2nd column, and therefore making the QTreeView needing to be much wider than necessary to contain the data.

    Any suggestions?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Salvatello
      wrote on last edited by
      #2

      Take a look at this http://qt-project.org/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox.
      but I have not used the ceckbox . I preferred to use the selected when I click . To select all the children I have created a recursive function that I select all the children of a folder.
      However if you want to use the ceckbox check here :
      http://qt-project.org/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox

      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