blob: 7b65d126c6a4b5a341babe5a477f21b56f7b6513 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class LTreeWidget : public QTreeWidget{
Q_OBJECT
public:
LTreeWidget(QWidget* parent = 0) : QTreeWidget(parent)
{
setSortingEnabled(false); // disbale the default built in sorting
// our sorting method
header()->setSortIndicatorShown(true);
header()->setClickable(true);
connect(header(), SIGNAL(sectionClicked(int)), this, SLOT(customSortByColumn(int)));
customSortByColumn(header()->sortIndicatorSection());
}
public slots:
void customSortByColumn(int column)
{
Qt::SortOrder order = header()->sortIndicatorOrder(); // get the order
sortItems(column, order);
}
};
|