Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have multi-column QTreeWidget root items

I am using a QTreeWidget to display items in categories. Items will use several columns, but I want categories (ie. root items) to use the full width of the widget.

How can I do that?

And a piece of my code:

class BugsList(QtGui.QDialog):
    def __init__(self, parent, reports):
        super(BugsList, self).__init__(parent) # Call QDialog constructor
        self._tree = QtGui.QTreeWidget(self)
        self._tree.setColumnCount(NUMBER_OF_COLUMNS)
        # ...
        for category, bugs in reports:
            category_widget = QtGui.QTreeWidgetItem(self._tree, [category])
            # ...

Here is a screenshot of the current state of my application: screenshot

like image 502
Valentin Lorentz Avatar asked Apr 07 '12 09:04

Valentin Lorentz


1 Answers

Fixed with using QTreeWidgetItem::setFirstColumnSpanned.

like image 93
Valentin Lorentz Avatar answered Sep 29 '22 12:09

Valentin Lorentz