summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-02-24 16:32:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-22 20:45:12 +0200
commit15953e95030ee42c78a84c48c7a3f3c2c448601f (patch)
tree628bc796efb6c825f09efa331e292d834603ae8d /tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
parentbe15856f61a949b8a01a1659c15af675c4c2f4e9 (diff)
QModelIndex: clean up integer size confusion in the API
QAIM::createIndex() took either int or quint32, but QMI::internalId() returned qint64. In the new interface, createIndex() takes, and internalId() provides, integers of type quintptr. This matches the storage size of the void* in the model index and avoids truncation. Remove the createIndex(int, int, quint32) and \obsolete createIndex(int,int,int) overloads. This makes a literal 0 in the third parameter ambiguous now. The solutions have been noted in changes-5.0.0. Change-Id: I0a0ecd8430eaf695129a4d09d14d4e30745485c4 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp')
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 352349f49a..b2a87164f1 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -3972,7 +3972,7 @@ public:
qint64 parentRowPlusOne = index.internalId();
if (parentRowPlusOne > 0) {
int row = static_cast<int>(parentRowPlusOne - 1);
- return createIndex(row, 0, (quint32)0);
+ return createIndex(row, 0);
}
}
return QModelIndex();
@@ -3992,7 +3992,7 @@ public:
QModelIndex index(int row, int column, const QModelIndex &parent) const
{
- return createIndex(row, column, parent.isValid() ? (quint32)(parent.row() + 1) : (quint32)0);
+ return createIndex(row, column, parent.isValid() ? (quintptr)(parent.row() + 1) : (quintptr)0);
}
public slots:
@@ -4003,16 +4003,16 @@ public slots:
if (current.isValid()) {
int selectedRow = current.row();
- quint32 parentRowPlusOne = static_cast<quint32>(current.internalId());
+ const quintptr parentRowPlusOne = current.internalId();
for (int i = 0; i < 2; ++i) {
// announce the removal of all non top level items
- beginRemoveRows(createIndex(i, 0, 0), 0, 3);
+ beginRemoveRows(createIndex(i, 0), 0, 3);
// nothing to actually do for the removal
endRemoveRows();
// put them back in again
- beginInsertRows(createIndex(i, 0, 0), 0, 3);
+ beginInsertRows(createIndex(i, 0), 0, 3);
// nothing to actually do for the insertion
endInsertRows();
}