summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/itemmodels/qstandarditem
diff options
context:
space:
mode:
authorLuca Beldi <v.ronin@yahoo.it>2018-08-01 16:43:31 +0100
committerLuca Beldi <v.ronin@yahoo.it>2018-08-17 07:17:12 +0000
commitd0069ff8c91e0027a0a1f3ef7767dbb13e0eacc4 (patch)
tree4305eb9240e4880edda8f355cdc057a92ce6dd6c /tests/auto/gui/itemmodels/qstandarditem
parent67352c92761fcb2e2c6a98b24e1bf5f33805cb3a (diff)
Add a method to clear the data to QStandardItemModel
After the behavior of setItemData has been changed following QTBUG-45114, QStandardItemModel was lacking an interface to clear all the data from a single index. Task-number: QTBUG-69616 Change-Id: Ide0b5bb6358439fc42c474df8b044fbace6def8d Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/gui/itemmodels/qstandarditem')
-rw-r--r--tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
index a45539a041..d19aa9b54f 100644
--- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
+++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
@@ -69,8 +69,20 @@ private slots:
void sortChildren();
void subclassing();
void lessThan();
+ void clearData();
};
+void tst_QStandardItem::clearData()
+{
+ QStandardItem item;
+ item.setData(QStringLiteral("Test"), Qt::EditRole);
+ item.setData(5, Qt::UserRole);
+ item.clearData();
+ QCOMPARE(item.data(Qt::EditRole), QVariant());
+ QCOMPARE(item.data(Qt::UserRole), QVariant());
+ QCOMPARE(item.data(Qt::DisplayRole), QVariant());
+}
+
void tst_QStandardItem::ctor()
{
QStandardItem item;