2023-05-31 14:29:03 +02:00
|
|
|
%{JS: Cpp.licenseTemplate()}\
|
2023-10-09 13:54:26 +02:00
|
|
|
@if '%{JS: Cpp.usePragmaOnce()}' == 'true'
|
2019-01-03 10:56:36 +01:00
|
|
|
#pragma once
|
|
|
|
|
@else
|
2015-10-19 14:19:41 +02:00
|
|
|
#ifndef %{GUARD}
|
|
|
|
|
#define %{GUARD}
|
2019-01-03 10:56:36 +01:00
|
|
|
@endif
|
2015-10-19 14:19:41 +02:00
|
|
|
|
|
|
|
|
%{JS: QtSupport.qtIncludes([ 'QtCore/%{Base}' ], [ 'QtCore/%{Base}' ])}\
|
|
|
|
|
%{JS: Cpp.openNamespaces('%{Class}')}\
|
|
|
|
|
|
|
|
|
|
class %{CN} : public %{Base}
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2016-10-07 16:34:26 +02:00
|
|
|
explicit %{CN}(QObject *parent = nullptr);
|
2015-10-19 14:19:41 +02:00
|
|
|
|
|
|
|
|
@if %{CustomHeader}
|
|
|
|
|
// Header:
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
|
|
@if %{Editable}
|
|
|
|
|
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
|
|
@endif
|
|
|
|
|
// Basic functionality:
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
2021-05-18 09:17:18 +02:00
|
|
|
@if %{DynamicFetch}
|
|
|
|
|
// Fetch data dynamically:
|
|
|
|
|
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
|
|
bool canFetchMore(const QModelIndex &parent) const override;
|
|
|
|
|
void fetchMore(const QModelIndex &parent) override;
|
|
|
|
|
|
|
|
|
|
@endif
|
2015-10-19 14:19:41 +02:00
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
|
|
@if %{Editable}
|
|
|
|
|
// Editable:
|
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value,
|
|
|
|
|
int role = Qt::EditRole) override;
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
|
|
@if %{AddData}
|
|
|
|
|
// Add data:
|
|
|
|
|
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
|
|
@if %{RemoveData}
|
|
|
|
|
// Remove data:
|
|
|
|
|
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
|
|
private:
|
|
|
|
|
};
|
|
|
|
|
%{JS: Cpp.closeNamespaces('%{Class}')}
|
2023-10-09 13:54:26 +02:00
|
|
|
@if '%{JS: Cpp.usePragmaOnce()}' === 'false'
|
2019-01-03 10:56:36 +01:00
|
|
|
#endif // %{GUARD}
|
|
|
|
|
@endif
|