diff --git a/share/qtcreator/templates/wizards/listmodel/listmodel.cpp b/share/qtcreator/templates/wizards/listmodel/listmodel.cpp index 8f10b68f04d5c70f84da2b6a8de2339a396201a1..b774d9a4ed46bd5264ab7fac96e6c7123b34c77f 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 25219f635cdccee0a706138e691af8335e04cfb9..a6c9c70619de104836a53c51378743063980bbd8 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;