diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-12-07 13:40:14 +0100 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-12-07 15:18:31 +0100 |
commit | 9a45e1853374c735dc08bf2e23b9d820900b1ccb (patch) | |
tree | 905311431b7985469bcf65e29667674a9510a6bf | |
parent | fb78a402b512b017c850e7410745c4d20da04a7c (diff) | |
download | qt4-tools-9a45e1853374c735dc08bf2e23b9d820900b1ccb.tar.gz |
Assert in designer while drag & dropping items from a QListWidget
Did not honour returned value from beginMoveRows(). Auto-test included.
Reviewed-by: leo
Task-number: QTBUG-6532
-rw-r--r-- | src/gui/itemviews/qlistwidget.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qlistwidget/tst_qlistwidget.cpp | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 5dd1d76bb3..929d688488 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -176,7 +176,8 @@ void QListModel::move(int srcRow, int dstRow) || dstRow < 0 || dstRow >= items.count()) return; - beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow); + if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow)) + return; if (srcRow < dstRow) --dstRow; items.move(srcRow, dstRow); diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index cb8f1e90b5..863c3088eb 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -867,6 +867,7 @@ void tst_QListWidget::moveItemsPriv_data() QTest::newRow("Same place") << 5 << 2 << 2 << false; QTest::newRow("Up") << 5 << 4 << 2 << true; QTest::newRow("Down") << 5 << 2 << 4 << true; + QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false; } void tst_QListWidget::moveItemsPriv() |