diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp index 4a438f48e49..71f9074a69b 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp @@ -84,7 +84,7 @@ bool %{CN}::setData(const QModelIndex &index, const QVariant &value, int role) { if (data(index, role) != value) { // FIXME: Implement me! - emit dataChanged(index, index, QVector() << role); + emit dataChanged(index, index, {role}); return true; } return false; @@ -95,7 +95,7 @@ Qt::ItemFlags %{CN}::flags(const QModelIndex &index) const if (!index.isValid()) return Qt::NoItemFlags; - return Qt::ItemIsEditable; // FIXME: Implement me! + return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; // FIXME: Implement me! } @endif @if %{AddData} @@ -105,6 +105,7 @@ bool %{CN}::insertRows(int row, int count, const QModelIndex &parent) beginInsertRows(parent, row, row + count - 1); // FIXME: Implement me! endInsertRows(); + return true; } bool %{CN}::insertColumns(int column, int count, const QModelIndex &parent) @@ -112,6 +113,7 @@ bool %{CN}::insertColumns(int column, int count, const QModelIndex &parent) beginInsertColumns(parent, column, column + count - 1); // FIXME: Implement me! endInsertColumns(); + return true; } @endif @if %{RemoveData} @@ -121,6 +123,7 @@ bool %{CN}::removeRows(int row, int count, const QModelIndex &parent) beginRemoveRows(parent, row, row + count - 1); // FIXME: Implement me! endRemoveRows(); + return true; } bool %{CN}::removeColumns(int column, int count, const QModelIndex &parent) @@ -128,6 +131,7 @@ bool %{CN}::removeColumns(int column, int count, const QModelIndex &parent) beginRemoveColumns(parent, column, column + count - 1); // FIXME: Implement me! endRemoveColumns(); + return true; } @endif %{JS: Cpp.closeNamespaces('%{Class}')}\ diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp index 921267d015d..9b08462ef4e 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp @@ -68,7 +68,7 @@ bool %{CN}::setData(const QModelIndex &index, const QVariant &value, int role) { if (data(index, role) != value) { // FIXME: Implement me! - emit dataChanged(index, index, QVector() << role); + emit dataChanged(index, index, {role}); return true; } return false; @@ -79,7 +79,7 @@ Qt::ItemFlags %{CN}::flags(const QModelIndex &index) const if (!index.isValid()) return Qt::NoItemFlags; - return Qt::ItemIsEditable; // FIXME: Implement me! + return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; // FIXME: Implement me! } @endif @if %{AddData} @@ -89,6 +89,7 @@ bool %{CN}::insertRows(int row, int count, const QModelIndex &parent) beginInsertRows(parent, row, row + count - 1); // FIXME: Implement me! endInsertRows(); + return true; } @endif @if %{RemoveData} @@ -98,6 +99,7 @@ bool %{CN}::removeRows(int row, int count, const QModelIndex &parent) beginRemoveRows(parent, row, row + count - 1); // FIXME: Implement me! endRemoveRows(); + return true; } @endif %{JS: Cpp.closeNamespaces('%{Class}')}\ diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp index e8c71f18bb9..794510501fa 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp @@ -75,7 +75,7 @@ bool %{CN}::setData(const QModelIndex &index, const QVariant &value, int role) { if (data(index, role) != value) { // FIXME: Implement me! - emit dataChanged(index, index, QVector() << role); + emit dataChanged(index, index, {role}); return true; } return false; @@ -86,7 +86,7 @@ Qt::ItemFlags %{CN}::flags(const QModelIndex &index) const if (!index.isValid()) return Qt::NoItemFlags; - return Qt::ItemIsEditable; // FIXME: Implement me! + return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; // FIXME: Implement me! } @endif @if %{AddData} @@ -96,6 +96,7 @@ bool %{CN}::insertRows(int row, int count, const QModelIndex &parent) beginInsertRows(parent, row, row + count - 1); // FIXME: Implement me! endInsertRows(); + return true; } bool %{CN}::insertColumns(int column, int count, const QModelIndex &parent) @@ -103,6 +104,7 @@ bool %{CN}::insertColumns(int column, int count, const QModelIndex &parent) beginInsertColumns(parent, column, column + count - 1); // FIXME: Implement me! endInsertColumns(); + return true; } @endif @if %{RemoveData} @@ -112,6 +114,7 @@ bool %{CN}::removeRows(int row, int count, const QModelIndex &parent) beginRemoveRows(parent, row, row + count - 1); // FIXME: Implement me! endRemoveRows(); + return true; } bool %{CN}::removeColumns(int column, int count, const QModelIndex &parent) @@ -119,6 +122,7 @@ bool %{CN}::removeColumns(int column, int count, const QModelIndex &parent) beginRemoveColumns(parent, column, column + count - 1); // FIXME: Implement me! endRemoveColumns(); + return true; } @endif %{JS: Cpp.closeNamespaces('%{Class}')}\