Important: Please read the Qt Code of Conduct -

QTreeWidget questions

  • Hello,

    I would like to reproduce the same kind of Tree that is shown on this attached image.
    I have two questions :

    • how to put the checkBox before the Top tree widget item on each line?
    • how to preserve the "qtreewidgetitem" idea by keeping the grid?
      What I mean is the following. If I take the first row on the picture, with the layer's name nab_ ... , if I do :
      this->setItemWidget(topLevelItem,0, layer_name);
      this->setItemWidget(topLevelItem,1, checkBox);
      this->setItemWidget(topLevelItem,2, checkBox);
      this->setItemWidget(topLevelItem,3, checkBox);
      etc ... then all these items (the checkboxes and the layer's name) don't belong to the same treewidgetitem.
      The issue is then for selection and for events.
      But if I create a CustomWidget with :
      QLabel(Layer_name) QCheckBox QCheckBox QCheckBox , and do
      then it's ok for selection and for events but you lose the treeWidget's alignement in grid as you just have one widget which contains all the the subitems (checkbox and labels in this example).

    How to combine the two? (regroup the items in a widget for selection, events, etc ... and preserve the grid with the columns splitters etc ...) ?

    Cheers,! After Effetcs)!

Log in to reply