Re: QSortFilterProxyModel: confusing with lessThan
Maurizio Berti <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <CAPn+-XRnrOAtSSu=rY_FPjypo-pc1uo8oNoZUCq8_qncUtf0dg@mail.gmail.com> |
Il giorno mar 30 lug 2019 alle ore 10:17 Gottfried Müller < [email protected]> ha scritto: > in a simple test I want to sort the items in an ascending order using my > own proxy. I expected a comparision of "itemLeft.text() < > itemRight.text()". But I had to code "itemRight.text() < > itemLeft.text()" getting the ascending order. > If you print self.proxy.sortOrder() you'll find out that you're currently using a descending order, which is why you've to invert the comparison. I suppose that's due to the default sortIndicatorOrder of the QTreeView header, which seems to be set to DescendingOrder if the indicator is not shown. Just use self.sortByColumn(0, QtCore.Qt.AscendingOrder) and it will work. Maurizio -- È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi http://www.jidesk.net _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt