Questions tagged [qtreewidget]

QTreeWidget is a class in Qt that provides a tree-like view of data.

This class uses a standard model to hold items, each of them being a QTreeWidgetItem.

Before adding data into the widget, a column count must be specified with setColumnCount() function. The widget can also have a header with a section for each of the columns. It also supports column-based sorting.

A simple example of using this class looks like this:

 //creating a widget
 QTreeWidget *myTreeWidget = new QTreeWidget();
 //adding a column to it
 myTreeWidget->setColumnCount(1);
 //creating a container to temporarily hold the items
 QList<QTreeWidgetItem *> itemList;
 //filling the container with items
 for (int i = 0; i < 10; ++i)
     itemList.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
 //finally, setting the items into the widget.
 myTreeWidget->insertTopLevelItems(0, itemList);

Official documentation can be found here for Qt 4.8 and here for Qt 5.

529 questions
-1
votes
3 answers

PyQt QTreeWidget problem with custom delegate

I'm trying to write simple property editor. I have automatically generated pyqt class (WorkZone in the code below), and I need to view/edit some of it's properties with PropertyEditor, with the delegate PropertyEditorDelegate, that uses custom…
Maxim Popravko
  • 4,100
  • 3
  • 29
  • 43
-2
votes
1 answer

Flash an active Qt tree widget item green

I would like to flash (between green & white) an active item in my QTreeWidget in Qt. This means it should stop flashing the previous items that were active once. I have tried the following and not had it working as I want it: **void…
coder
  • 21
  • 3
-2
votes
1 answer

How to restore to normal to Qtreewidget Pyqt5?

I just made a program with QTreeWidget.But I want to restore it to normal when I click a button,I mean it should be same as when it started. I learned how to remove the selected section that appears with a blue horizontal…
Hacker6914
  • 247
  • 1
  • 9
-2
votes
1 answer

How to move arrows to the next column in qtreewidget

In pyqt5, using qtreewidget, I'm trying to shift the arrows under the next header. Is this possible? I would like to add a thumbnail to the first column and have the arrows in the second. This is what I have at the moment. This is what I get when I…
Jeremy
  • 41
  • 4
1 2 3
35
36