Files
qt-creator/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp
Christian Kandeler a296b84dc4 Wizards: Fix include statements
The header file must be referenced relative to the location of the
source file.

Task-number: QTCREATORBUG-15599
Change-Id: Ib7d4aa5a62a94541cbe32cd340a8a1e7d6ef35e5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-04-30 10:47:44 +00:00

107 lines
2.4 KiB
C++

%{Cpp:LicenseTemplate}\
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
%{JS: Cpp.openNamespaces('%{Class}')}\
%{CN}::%{CN}(QObject *parent)
: %{Base}(parent)
{
}
@if %{CustomHeader}
QVariant %{CN}::headerData(int section, Qt::Orientation orientation, int role) const
{
// FIXME: Implement me!
}
@if %{Editable}
bool %{CN}::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
{
if (value != headerData(section, orientation, role)) {
// FIXME: Implement me!
emit headerDataChanged(orientation, section, section);
return true;
}
return false;
}
@endif
@endif
int %{CN}::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
// FIXME: Implement me!
}
int %{CN}::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
// FIXME: Implement me!
}
QVariant %{CN}::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
// FIXME: Implement me!
return QVariant();
}
@if %{Editable}
bool %{CN}::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (data(index, role) != value) {
// FIXME: Implement me!
emit dataChanged(index, index, QVector<int>() << role);
return true;
}
return false;
}
Qt::ItemFlags %{CN}::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::NoItemFlags;
return Qt::ItemIsEditable; // FIXME: Implement me!
}
@endif
@if %{AddData}
bool %{CN}::insertRows(int row, int count, const QModelIndex &parent)
{
beginInsertRows(parent, row, row + count - 1);
// FIXME: Implement me!
endInsertRows();
}
bool %{CN}::insertColumns(int column, int count, const QModelIndex &parent)
{
beginInsertColumns(parent, column, column + count - 1);
// FIXME: Implement me!
endInsertColumns();
}
@endif
@if %{RemoveData}
bool %{CN}::removeRows(int row, int count, const QModelIndex &parent)
{
beginRemoveRows(parent, row, row + count - 1);
// FIXME: Implement me!
endRemoveRows();
}
bool %{CN}::removeColumns(int column, int count, const QModelIndex &parent)
{
beginRemoveColumns(parent, column, column + count - 1);
// FIXME: Implement me!
endRemoveColumns();
}
@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\