diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-10 17:18:59 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-10 19:58:48 +0200 |
commit | 84e76c37a5fb040e63f1eabf2fb7010d782a7106 (patch) | |
tree | 794d95d8dce2e15f0784d3d05606d8dd957a5dc7 /tests/auto/gui/itemmodels | |
parent | 7ec12b2902cc84a85ac6fe05ea98f76efa214344 (diff) |
Restore default role names in QStandardItemModel::roleNames()
Amends 32b586864e3a4398da38c045f4ac0823c3dc3c57, which added an override
of QStandardItemModel::roleNames(). It's good for it to have its own
QHash so that roles can be added, and because
QStandardItemModel::setItemRoleNames() remains un-deprecated; but before
that change, they were the roles that QAbstractItemModel had initialized
from QAbstractItemModelPrivate::defaultRoleNames(). In particular, we
need "display" to map to Qt::DisplayRole by default; several tests in
qtdeclarative depend on that.
Change-Id: I58b2d6aa6b6c78b1d618335ddc4ecb834af57274
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui/itemmodels')
-rw-r--r-- | tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index 65c99d34b5..04a3fe7a62 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -31,6 +31,7 @@ #include <QStandardItemModel> #include <QTreeView> +#include <private/qabstractitemmodel_p.h> #include <private/qtreeview_p.h> class tst_QStandardItemModel : public QObject @@ -126,6 +127,7 @@ private slots: #endif void removeRowsAndColumns(); + void defaultItemRoles(); void itemRoleNames(); void getMimeDataWithInvalidModelIndex(); void supportedDragDropActions(); @@ -1598,6 +1600,12 @@ void tst_QStandardItemModel::removeRowsAndColumns() VERIFY_MODEL } +void tst_QStandardItemModel::defaultItemRoles() +{ + QStandardItemModel model; + QCOMPARE(model.roleNames(), QAbstractItemModelPrivate::defaultRoleNames()); +} + void tst_QStandardItemModel::itemRoleNames() { QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector(); |