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).

219 questions
30
votes
11 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
  • 51,293
  • 14
  • 84
  • 114
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
  • 1,051
  • 5
  • 14
  • 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,551
  • 6
  • 39
  • 61
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,634
  • 10
  • 46
  • 85
10
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
  • 2,208
  • 4
  • 32
  • 47
8
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,299
  • 5
  • 23
  • 38
8
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…
JuanDeLosMuertos
  • 4,532
  • 15
  • 55
  • 87
8
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 ?
Denis
  • 2,786
  • 1
  • 14
  • 29
7
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
  • 85
  • 1
  • 2
  • 4
7
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,406
  • 10
  • 32
  • 55
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,929
  • 4
  • 30
  • 73
5
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
  • 87
  • 1
  • 6
4
votes
0 answers

FIXED: QTreeWidget change the branch hover style when hovering over an item

Im working on a project (big and complex) that i have to re-style using CSS and c++. For this project there is a custom QTreeWidget that must look like this: The question is, how i can change the hover background color of the "arrow"/ indicator,…
4
votes
2 answers

QTreeWidget : disable a line but not the subtree

I use a QTreeWidget that shows a file listing so that a user can copy files to a directory. I want to disallow the user to copy the files to the same directory. Thus, I want to disable just one line in my QTreeWidget so that it is not selectable. I…
Tangui
  • 3,626
  • 2
  • 26
  • 28
4
votes
5 answers

PyQt: reset or remove the background color from QTreeWidgetItem

How do I remove the background color of a QTreeWidgetItem, or reset it to the default? treeWidgetItem.setBackgroundColor(0, QtGui.QColor('green'))
moDong
  • 223
  • 2
  • 5
  • 9
1
2 3
14 15