[Qt-interest] Sorting QTableWidget's column with checked items

Malyushytsky, Alex alex at wai.com
Fri Apr 17 01:30:42 CEST 2009


For QTableWidget you probably can subclass
virtual bool operator< ( const QTableWidgetItem & other ) const
to take into account the values in the other columns ( in case *this == other )

Normally for QTableView you either would use

a) QSortFilterProxyModel overriding
bool QSortFilterProxyModel::lessThan ( const QModelIndex & left, const QModelIndex & right ) const   [virtual protected]
or would override


b) or directly overriding virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ) in QAbstractTableModel or other QAbstractItemModel derived class


Regards,
            Alex
________________________________________
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Iurii Gordiienko
Sent: Thursday, April 16, 2009 6:15 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Sorting QTableWidget's column with checked items


>How can I sort column with checked items (these items has no text at all)
I found operator< for QTableWidgetItem - no question about this...
But how can I sort more that one columns?

--- Original Message ---
From: "Iurii Gordiienko" <hordi at ukr.net>
To: qt-interest at trolltech.com
Date: 16 april, 14:16:34
Subject: [Qt-interest] Sorting QTableWidget's column with checked items
Hi How can I sort column with checked items (these items haso no text at all)? I attach example with simple QTableWidget - it's first column has only checked items and I can't understand why item is moved to top after check-uncheck it... How can I reimplement QTableWidget's sorting behavior (I want implement own sort-order - I need sort QTableWidget by several columns)? Qt-4.5.0 Thanks



--
Рецепт успеха в Сети. Новый номер журнала InternetUA.


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list