Questions tagged [qtreewidgetitem]

The QTreeWidgetItem class, part of the Qt framework, provides an item for use with the QTreeWidget class.

Documentation can be found here (Qt4) and here (Qt5).

205 questions
27
votes
10 answers

Making only one column of a QTreeWidgetItem editable

I have a QTreeWidgetItem with two columns of data, is there any way to make only the second column editable? When I do the following: QTreeWidgetItem* item = new QTreeWidgetItem(); item->setFlags(item->flags() | Qt::ItemIsEditable); all columns…
Andreas Brinck
  • 47,252
  • 14
  • 79
  • 112
12
votes
5 answers

Is it possible to create a signal for when a QTreeWidgetItem checkbox is toggled?

I've created a checkbox that's also a QTreeWidgetItem using the code below. //Populate list QTreeWidgetItem *program = createCheckedTreeItem(QString::fromStdString(itr->first), true); treePrograms->addTopLevelItem(program); QTreeWidgetItem*…
Robert Whitley
  • 981
  • 3
  • 13
  • 28
12
votes
4 answers

How to delete QTreeWidgetItem

Several webpages say that QTreeWidgetItem can be deleted by deleting or QTreeWidget.clearing. But my code sample below doesn't seem to do so. Am I doing anything wrong? #!/usr/bin/python import sys from PySide.QtGui import QApplication, QWidget,…
IsaacS
  • 3,249
  • 3
  • 37
  • 59
10
votes
3 answers

How do I delete a top level QTreeWidgetItem from a QTreeWidget?

I'm attempting to remove a top level tree widget item if there are no child nodes within the top level item. What is the correct way to do this? I can't seem to find the API call within Qt's documentation. Is it safe to just call delete on the top…
Cameron Tinker
  • 9,119
  • 10
  • 42
  • 80
9
votes
1 answer

QTreeWidget reordering child items by dragging

I have a QTreeWidget which displays a single root node and one level of child nodes only. I need to permit the re-ordering of the child nodes. They must never be re-parented. This is how I enable the dragging of items in the QTreeWidget…
Simon
  • 1,918
  • 3
  • 28
  • 40
7
votes
4 answers

Is it possible to sort numbers in a QTreeWidget column?

I have a QTreeWidget with a column filled with some numbers, how can I sort them? If I use setSortingEnabled(true); I can sort correctly only strings, so my column is sorted: 1 10 100 2 20 200 but this is not the thing I…
Giancarlo
  • 4,122
  • 15
  • 49
  • 82
7
votes
1 answer

QTreeWidgetItem find child by text

How to find item in QTreeWidgetItem by text? Is there an analog of QTreeWidget's findItem method ?
user3514538
  • 2,294
  • 1
  • 11
  • 21
6
votes
1 answer

Python PyQt5 QTreeWidget sub item

How to create sub item in the QTreeWidget? I was able to create top level items (listing below), but still looking for sub items. PyQt->5.6 Python->3.5 Spyder->3.0.2 import sys from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QApplication,…
Damian
  • 75
  • 1
  • 2
  • 4
6
votes
2 answers

How to get the number of items of a QTreeWidget

I have created a QTreeWidget, I'm trying to list all the items displayed. I do not want to go inside the items if the item have child but not expanded. It's really getting the number of Items I can see in the tree. I have tried : for( int i = 0;…
Seb
  • 2,365
  • 3
  • 20
  • 41
5
votes
4 answers

PyQt Tree Widget, adding check boxes for dynamic removal

I am attempting to create a tree widget that will essentially allow the user to view various breakdowns of data and have the option to delete certain items. In order to do this I want to have check boxes associated with each top level item and each…
sudobangbang
  • 1,194
  • 7
  • 23
  • 52
4
votes
3 answers

How to insert child into QTreeWidget hierarchy?

Consider I have QTreeWidget with following items hierarchy: top_item |--child Every item has assigned with setItemWidget() widget. I need to insert another child between my first two elements like this : top_item |--another_child …
MaxNes
  • 81
  • 1
  • 1
  • 4
4
votes
1 answer

PyQt: get the current QTreeWidget item

I presently have a QTreeWidget named 'treeWidget', and for the life of me, cannot figure out how to get the index value or the text of the selected treeWidget branch. self.treeWidget looks like: User -Inbox -Sent -Drafts -Trash I need to know which…
Ang
  • 43
  • 1
  • 1
  • 3
4
votes
2 answers

Individual QTreeWidgetItem indentation

Is it possible to have individual indentation of items in a QTreeWidget? In specific, I have have a column containing both text, icon and for some of them a CheckBox. The items without a CheckBox gets shifted to the left so the indentation of the…
Magus
  • 77
  • 1
  • 5
4
votes
3 answers

add checkbox to qtreewidgetitem

i want to add a check box to my qtreewigetitem, i tried this code to setflag, then i add item is selectable for sake of maybe this will solve my problem but nothing happened, would you please help me how can i add check box to my item? thank you in…
mari
  • 367
  • 1
  • 4
  • 19
3
votes
3 answers

Why is there a 1 at the top of a QTreeWidget?

There is a 1 at the top of a QtreeWidget. How do i fix it?
Geore Shg
  • 1,199
  • 3
  • 21
  • 38
1
2 3
13 14