If your data is stored in a database model or if you want to have a single data model and show it in some views in different ways, then you are definitely better to go with QTreeView. But QTreeWidget has it's internal model in some way along with the methods...

I've implemented two solutions, you'll need to comment/uncomment the code. The result is the same in both case. Solution 1 is based on the reference of the asset you are using in PublishInfoUI class and. Once you press "OK", the modifcations are done inside the PublishInfoUI class on self.assets. On...

The itemClicked signal is not a good choice for handling treewidget checkboxes. On the one hand, it gives false positives when not clicking on the checkbox part of an item; and on the other hand, it gives false negatives when the checkbox is toggled using the keyboard. I think the...

I found the solution: My first code was this QTreeWidgetItem* newVtxItem = new QTreeWidgetItem(parentItem); newVtxItem->setText(0, "vtx 1"); newVtxItem->setText(1, "-1"); childOfNameProfile->insertChild(0,newVtxItem); Then I correct it by deleting the parentItem of the new QTreeWidgetItem in this way: QTreeWidgetItem* newVtxItem = new QTreeWidgetItem(); newVtxItem->setText(0, "vtx 1"); newVtxItem->setText(1, "-1"); childOfNameProfile->insertChild(0,newVtxItem); The reason why the...

I think this is what you meant: UI has in a layout: Label, QTreeWidget, Label, Spacer (Spacer is important becaus else Qt might just expand the labels to fill the window.) Important: In Designer TreeWidget hight to preffered, vertical scrollbar off. UI Example: <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget...

to list items in groups here a simalar question: How to list items as groups in QListWidget if headeritems and normal items are different in one property they can be handled differently in slot. I'm not quite certain, if it's the way you want. I tried to place checked items...

AFAIK stylesheet is not a panacea for everything. You want very specific thing so you should look deeper and use something more powerful. I suggest you to use delegate. You didn't provide specification, so I provide main idea. In QStyledItemDelegate subclass reimplement paint. For example: void ItemDelegatePaint::paint(QPainter *painter, const QStyleOptionViewItem...

This solution does not avoid duplicate, so if you need that in the future, you could extend this piece of code with adding valiation for that. Anyway, this code produces the exact ame output for me that you have just described to wish to have. main.cpp #include <QTreeWidget> #include <QStringList>...