codemonkey
4th October 2009, 10:17
As I've written in another thread, I have subclassed
class QInt64Item : public QTableWidgetItem
{
public:
QInt64Item(qint64 data=0);
QVariant data(int role) const;
bool operator< ( const QInt64Item& other ) const;
protected:
qint64 m_data;
};
and sorting the data (clicking on the header of the table) works (=sorted as expected) as long as
QInt64Item::data(Qt::DisplayRole) returns the qint64 variable m_data, and not QString::number(m_data).
This puzzles me. What sort is acctually beeing run when clicking in the table header?
My comparison function
bool QInt64Item::operator< ( const QInt64Item& other ) const
{
return m_data < other.m_data;
}
can't possible be used for this. :confused:
So how does this acctually work?
class QInt64Item : public QTableWidgetItem
{
public:
QInt64Item(qint64 data=0);
QVariant data(int role) const;
bool operator< ( const QInt64Item& other ) const;
protected:
qint64 m_data;
};
and sorting the data (clicking on the header of the table) works (=sorted as expected) as long as
QInt64Item::data(Qt::DisplayRole) returns the qint64 variable m_data, and not QString::number(m_data).
This puzzles me. What sort is acctually beeing run when clicking in the table header?
My comparison function
bool QInt64Item::operator< ( const QInt64Item& other ) const
{
return m_data < other.m_data;
}
can't possible be used for this. :confused:
So how does this acctually work?