From 8dd71a919970e12de0b88de3efc8caa1dafb02fd Mon Sep 17 00:00:00 2001 From: Daniel Molkentin <daniel.molkentin@nokia.com> Date: Mon, 2 May 2011 17:22:38 +0200 Subject: [PATCH] Let the ListModel wizard generate a valid model. --- share/qtcreator/templates/wizards/listmodel/listmodel.cpp | 2 +- share/qtcreator/templates/wizards/listmodel/listmodel.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/templates/wizards/listmodel/listmodel.cpp b/share/qtcreator/templates/wizards/listmodel/listmodel.cpp index 8f10b68f04d..b774d9a4ed4 100644 --- a/share/qtcreator/templates/wizards/listmodel/listmodel.cpp +++ b/share/qtcreator/templates/wizards/listmodel/listmodel.cpp @@ -17,7 +17,7 @@ int %ClassName%::rowCount(const QModelIndex &) const return items.size(); } -QVariant %ClassName%::data(const QModelIndex &index, int) +QVariant %ClassName%::data(const QModelIndex &index, int) const { return items.at(index.row()); } diff --git a/share/qtcreator/templates/wizards/listmodel/listmodel.h b/share/qtcreator/templates/wizards/listmodel/listmodel.h index 25219f635cd..a6c9c70619d 100644 --- a/share/qtcreator/templates/wizards/listmodel/listmodel.h +++ b/share/qtcreator/templates/wizards/listmodel/listmodel.h @@ -11,7 +11,7 @@ public: void addItems(const QList<%Datatype%> &items); virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole); + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; private: QList<%Datatype%> items; -- GitLab