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. changing the checkstate of all the child item by checking the root item in Qtree widget
Forum Updated to NodeBB v4.3 + New Features

changing the checkstate of all the child item by checking the root item in Qtree widget

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 4 Posters 2.7k 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.
  • jsulmJ jsulm

    @kook I just fixed my code...

    K Offline
    K Offline
    kook
    wrote on last edited by
    #21

    @jsulm its not changing the checked state of children

    jsulmJ 1 Reply Last reply
    0
    • K kook

      @jsulm its not changing the checked state of children

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #22

      @kook said in changing the checkstate of all the child item by checking the root item in Qtree widget:

      its not changing the checked state of children

      Come on, that's because I did not add the code to change the checked state. Add that part:

      void MainWindow::on_treeWidget_itemChanged(QTreeWidgetItem *item, int column)
          for (int i = 0; i < item->childCount(); ++i) {
              qDebug() << item->child(i)->text(0);
              item->child(i)->setCheckState(0, item->checkState(0));
              on_treeWidget_itemChanged(item->child(i), column);
          }
      }
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      3
      • jsulmJ jsulm

        @kook said in changing the checkstate of all the child item by checking the root item in Qtree widget:

        its not changing the checked state of children

        Come on, that's because I did not add the code to change the checked state. Add that part:

        void MainWindow::on_treeWidget_itemChanged(QTreeWidgetItem *item, int column)
            for (int i = 0; i < item->childCount(); ++i) {
                qDebug() << item->child(i)->text(0);
                item->child(i)->setCheckState(0, item->checkState(0));
                on_treeWidget_itemChanged(item->child(i), column);
            }
        }
        
        K Offline
        K Offline
        kook
        wrote on last edited by
        #23

        @jsulm sorry i added that part its working
        thank you for your time and solution

        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