I've created a QTreeWidget subclass and a QTreeWidgetItem subclass. They work, except for the sorting. When I click on the headers, nothing changes except for the sorting indicator.

setSorting is enabled, so that isn't it. Now, it doesn't even sort by string-value. But also, I'm missing a reimplementable function in QTreeWidgetItem. I suspected something like:

virtual int QTreeWidgetItem::compare(int column); // -1, 0 or 1

or something. Because two of the columns actually represent QDateTime variables, and I don't want them to be sorted as strings.

So, how do I implement sorting?

Thanks!