diff options
author | J-P Nurmi <jpnurmi@gmail.com> | 2009-06-09 20:44:32 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-06-10 13:45:12 (GMT) |
commit | 09faf56a2e44b4dfa1b341ced75803100483834f (patch) | |
tree | f3a4eac74c66959b802017b56f7876b07b57da0e /src/gui/itemviews/qtablewidget.cpp | |
parent | dd3ee408148368a6f900844afc68fff9d86c2e8c (diff) | |
download | Qt-09faf56a2e44b4dfa1b341ced75803100483834f.zip Qt-09faf56a2e44b4dfa1b341ced75803100483834f.tar.gz Qt-09faf56a2e44b4dfa1b341ced75803100483834f.tar.bz2 |
Added QAbstractItemModelPrivate::canConvertToDouble().
And changed QTreeWidgetItem::operator<() and
QTableWidgetItem::operator<() to use it
Merge-request: 631
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Diffstat (limited to 'src/gui/itemviews/qtablewidget.cpp')
-rw-r--r-- | src/gui/itemviews/qtablewidget.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index 8cb2e55..072e435 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -530,24 +530,6 @@ void QTableModel::sort(int column, Qt::SortOrder order) emit layoutChanged(); } -bool QTableModel::canConvertToDouble(const QVariant &value) -{ - switch (value.type()) { - case QVariant::Bool: - case QVariant::Int: - case QVariant::UInt: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::Double: - case QVariant::Char: - return true; - default: - return false; - } - return false; -} - - /* \internal @@ -1410,7 +1392,7 @@ QVariant QTableWidgetItem::data(int role) const bool QTableWidgetItem::operator<(const QTableWidgetItem &other) const { const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole); - if (QTableModel::canConvertToDouble(v1) && QTableModel::canConvertToDouble(v2)) + if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2)) return v1.toDouble() < v2.toDouble(); return v1.toString() < v2.toString(); } |