Wizards: Fix generation of dynamically populated models

This was implemented for QAbstractItemModel based classes, but
forgotten for QAbstractListModel and QAbstractTableModel based
classes.

Change-Id: I807f445e48d2906580abd0a65bb794d6e766c1a7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2021-05-18 09:17:18 +02:00
parent b87c3cc03e
commit 2e24d4b0cc
4 changed files with 52 additions and 0 deletions

View File

@@ -35,6 +35,24 @@ int %{CN}::rowCount(const QModelIndex &parent) const
// FIXME: Implement me! // FIXME: Implement me!
} }
@if %{DynamicFetch}
bool %{CN}::hasChildren(const QModelIndex &parent) const
{
// FIXME: Implement me!
}
bool %{CN}::canFetchMore(const QModelIndex &parent) const
{
// FIXME: Implement me!
return false;
}
void %{CN}::fetchMore(const QModelIndex &parent)
{
// FIXME: Implement me!
}
@endif
QVariant %{CN}::data(const QModelIndex &index, int role) const QVariant %{CN}::data(const QModelIndex &index, int role) const
{ {

View File

@@ -28,6 +28,14 @@ public:
// Basic functionality: // Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
@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
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
@if %{Editable} @if %{Editable}

View File

@@ -42,6 +42,24 @@ int %{CN}::columnCount(const QModelIndex &parent) const
// FIXME: Implement me! // FIXME: Implement me!
} }
@if %{DynamicFetch}
bool %{CN}::hasChildren(const QModelIndex &parent) const
{
// FIXME: Implement me!
}
bool %{CN}::canFetchMore(const QModelIndex &parent) const
{
// FIXME: Implement me!
return false;
}
void %{CN}::fetchMore(const QModelIndex &parent)
{
// FIXME: Implement me!
}
@endif
QVariant %{CN}::data(const QModelIndex &index, int role) const QVariant %{CN}::data(const QModelIndex &index, int role) const
{ {

View File

@@ -29,6 +29,14 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override;
@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
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
@if %{Editable} @if %{Editable}