qtreewidget

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 want! Suggestions? ...

How to automatically sort a QTreeWidget column?

Hello, i'm using a QTreeWidget to display some simple items. I've set the list sortable by .setSortingEnabled(true) calling. In this way, the list is sorted only when the user press the title column, and not automatically whenever new item is inserted. I have two question: Is there a way to force the automatic sorting in a specified co...

Problem with QVariant/QTreeWidgetItem/iterator on qt4.4.3

Hello, here's my problem: In my qt app I have this object, filled before setting up my QTreeWidget's content: QList<QTreeWidgetItem*> items; I fill the QList by this way: QVariant qv; // I need this for "attaching" to the item my linuxPackage object qv.setValue(linuxPackage); packRow->setData(1, Qt::UserRole,qv); // packRow is m...

Removing rows from QTreeWidget (qt programming)

what's the best way to remove a row (QTreeWidgetItem) from a QTreeWidget? The QTreeWidget content has been set by: myQTreeWidget->insertTopLevelItems(0, items); // items = QList<QTreeWidgetItem*> then I remove an item from my QList "items" and I try to clear/reset the QTreeWidget packList->clear(); packList->insertTopLevelItems(...

How to clear QTreeWidget?

i have the requirement to list all project files in tree view..i want to clear the treewidget each time new project is loaded.i used ui->treewidget->clear(); , but i m getting error reports,,plse suggest me possible solutions.. ...

Automatically sorting on insert in QTreeWidget

I have a QTreeWidget that I insert items in, and the user can select a column to sort it. As the items are being inserted, they just get appended to the end instead of having the sort being done automatically. If I click the header to switch between ascending/descending it will sort the current items. I figured I could call sortItems() ...

Slow selection in QTreeView, why?

I've recently hit a wall in a project I'm working on which uses PyQt. I have a QTreeView hooked up to a QAbstractItemModel which typically has thousands of nodes in it. So far, it works alright, but I realized today that selecting a lot of nodes is very slow. After some digging, it turns out that QAbstractItemModel.parent() is called way...

Invoking context menu in QTreeWidget

I would like to popup a menu, when user clicks on an object in QTreeWidgetItem. I though about catching signal contextMenuRequested from QWidget and then retrieving index from the view using itemAt. But this doesn't seem very pretty. Is there any easier way to be able to call a menu on an item inside a view? ...

PyQt Qtreewidget turn off selection

By default a QTreeWidget manages the selection of rows [when you click a row it highlights it, when you click another row it highlights that and deselects the previous row] , I dont want this and cant figure out how to turn it off. ...

Raise and lower QTreeWidgetItem in a QTreeWidget?

Question says it all how do you raise and lower [change the positions of ] QTreeWidgetItems in a QtreeWidget , ...

Qt QTreeWidget preserve sort

How do you implement a preserve sort in a Qt QTreeWidget? I.e. I would like the previous order of the tree preserved as much as possible. This allows the user to do something like click the "Name" column header and then the "Date" column header, and the resulting tree shows the items in the QTreeWidget by Date and then by Name. ...

stable sorting QTreeWidgetItems in QTreeWidget?

Hi all, I have a list of QTreeWidgetItems (with children) in a QTreeWidget. I do not use a model for my data. From another window in my application the user can navigate thru the same set of data (viewed differently) and the QTreeWidget in the first window then highlights that specific row by setting the background colour. However, wh...

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 icon and the text is not inline with the others. Could maybe be fixed with a hidden CheckBo...

PyQt QTreeWidget problem with custom delegate

Hi, All! 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 editors ColorEditor, LineEditor, etc. Main idea is that WorkZone knows what propertie...

pyqt QTreeWidget setItemWidget dissapears after drag/drop

I'm trying to keep a widget put into a QTreeWidgetItem after a reparent (drag and drop) using QTreeWidget.setItemWidget() But the result, if you compile the following code - is that the widget inside the QTreeWidgetItem disappears. Any idea why? What code would fix this (repopulate the QTreeWidgetItem with the widget I guess?) from Py...

QTreeWidget insertTopLevelItem - index given not accurately displayed in Tree?

I am unable to properly insert a QTreeWidgetItem at a specific index, in this case I am removing all QTreeWidgetItems from the tree, doing a custom sort on their Date Objects and then inserting them back into the QTreeWidget. However, upon inserting (even one at a time) the QTreeWidgetItem is not inserted into the correct place. The ...

QTreeWidget activate item signals

Hi everyone, I need to do some actions when item in QTreeWidget activates, but following code doestn't gives me expected result: class MyWidget(QTreeWidget): def __init__(self, parent=None): super(MyWidget, self).__init__(parent) self.connect(self, SIGNAL("activated(QModelIndex)"), self.editCell) def editCell...

Is there a way to detect when all child items within a QTreeWidgetItem have been marked 'hidden'?

Is there a preferred way to detect when all of a QTreeWidgetItem's children are marked as hidden? Currently, I'm iterating over all of them every time any of them are hidden. ...

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 tried to use the setDisable(bool) method of the QTreeWidgetItem object but the problem is ...