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
0
votes
1 answer

Get ItemWidget from QTreeWidget on DoubleClick event

I created a QTreeWidget now when i click on an item, i want to get the widget data. I fill my QTreeWidget that way : def addNodeToTreeview(self, data): self.panelInfoPatientUi.treeWidgetDevices.clear() for item in data: …
PyNico
  • 695
  • 5
  • 21
0
votes
1 answer

Limit the number of items in a QTreeWidget

Is there a way to limit the number of items my QTreeWidget can have, similar to a FIFO buffer ?
Garjy
  • 467
  • 5
  • 12
0
votes
1 answer

How to read a mimedata coming from QTreeWidget in a QFrame void DragWidget::dropEvent(QDropEvent *event), where DragWidget::QFrame

debug mode image Can anyone help me reading the text from QByteArray as iam new to Qt. Also its a internal drag and drop from QTreeWidget to a QFrame. How can i get the QTreeWidgetItem if i am dragging the item from Qtrewidgetitem to QFrame…
0
votes
1 answer

PyQt TreeWidget Smooth updating (model-view?)

I am trying to update a QTreeWidget every 60 seconds. I have it on a QTimer right now but my concern is that when it updates it will disrupt the users progress(for example if they have a parent opened up so you can see the children, when I update it…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55
0
votes
3 answers

How to disable right click in a QTreeWidget in PyQt?

I have a QTreeWidget where I want to disable right click on the item. Currently I am using itemClicked signal to detect clicks on children of the treeWidget, but I only want to do something when the user left clicks an item and do nothing on right…
coder006
  • 525
  • 1
  • 6
  • 15
0
votes
0 answers

QTreeWidgetItem editing finished slot

For a while now I am trying to figure out how to trigger a signal when an item in a QTreeWidget is edited. I tried to use the slots like currentItemChanged, ItemEntered and others from the QTreeWidget but they do not trigger. I would aprichiate all…
Łukasz Przeniosło
  • 2,725
  • 5
  • 38
  • 74
0
votes
0 answers

Prohibition of current item changing in QTreeWidget

How I can prohibit changing current item in QTreeWidget (under certain conditions). The problem is that the signal QTreeWidget::currentItemChanged triggered after the changing. P.S. I tried to override QTreeView::currentChanged and do nothing in it,…
ZolotovPavel
  • 138
  • 6
0
votes
1 answer

QTreeWidget findItems or filter by icon

I'm using QTreeWidget with icons and strings data. Right now I'm using my own filter function to filter out string via QTreeWidget::findItems function and it's works pretty good. BUT, how can I filter/findItems by icons ? The Qt findItems functions…
Simon
  • 1,522
  • 2
  • 12
  • 24
0
votes
0 answers

PyQt QTreeWidget - odd delay when setting all checkboxes to unchecked

I am building an application with PyQt4 and Python3 that is using a QTreeWidget to give users a way to select what portions of their data that they want interact with after it has been loaded into the application. The tree usually has 3 levels.…
dan_g
  • 2,712
  • 5
  • 25
  • 44
0
votes
1 answer

How to used itemExpanded with a subclass of QTreeWidgetItem

I do have a connection related to SIGNAL/SLOT use in Qt/C++ I have wrote an app using a QTreeWidget + QTreeWidgetItems. For the need of the app, I had to subclass QTreeWidgetItem to MyQTreeWidgetItem in order to add some parameters. Since I move…
Seb
  • 2,929
  • 4
  • 30
  • 73
0
votes
1 answer

Map values from an UI into QTreeWidget Column

sorry if my following question sounds stupid but I am pretty much in a lost, big way! I have created 2 UIs using the Qt-Designer. Main UI (anmgToolUI) - http://pastebin.com/raw.php?i=eXVWj99Q Sub UI (publishInfoUI) - …
yan
  • 631
  • 9
  • 30
0
votes
1 answer

QTreeWidget Stylesheet Color for Childs

System: Linux Mint, QT Creator from Repo -> QT Version 5.2, C++) I've created a Customwidget wich Im using inside a QTreeView OwnItem *OI = new OwnItem; QTreeWidgetItem *itemN = new…
hypnomaki
  • 593
  • 9
  • 22
0
votes
1 answer

QtreeWidget Border Issue

I have a qtreewidget in my application. I have set the stylesheet like below for it. setFrameShape(QFrame::NoFrame); setStyleSheet("QTreeView { border: none; background: transparent; outline:none; }" "QTreeView::item:!selected:hover { border: 1px…
user3336091
  • 17
  • 1
  • 6
0
votes
1 answer

Add same items in QTreeWidget

I have 2 QTreeWidgets (treeWidget_rigResults, treeWidget_migrateAnm) in my UI, similar but with different number of columns. Anyway, I realized that while I am able to add my selection from treeWidget_rigResults into treeWidget_migrateAnm, I am only…
yan
  • 631
  • 9
  • 30
0
votes
1 answer

double click to edit a QtreeWidget column

I have a QTreeWidget in which it has 4 columns (Name, version, ID, Location). While I have the first 3 columns populated, I had wanted the last column - Location to be user-input where Users have to specify the file location of another file before…
yan
  • 631
  • 9
  • 30