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. how to make treewidgets items with checkboxes

how to make treewidgets items with checkboxes

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 742 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    how to make a tree widget or treeview with checkboxes like this
    0_1541490159794_rpvv5.png

    mrjjM 1 Reply Last reply
    0
    • ? A Former User

      how to make a tree widget or treeview with checkboxes like this
      0_1541490159794_rpvv5.png

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @davidlabib
      Hi
      You can flag each items as check able

      QTreeWidgetItem* item = new QTreeWidgetItem();
      item->setFlags(item->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
      item->setCheckState(Qt::Checked);// check it
      
      1 Reply Last reply
      2
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        For QTreeWidget see QTreeWidgetItem::flags()
        For QTreeView see the QAbstractItemModel::flags() and QAbstractItemModel::data() with Qt::CheckStateRole

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3

        • Login

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