mirror of
https://github.com/status-im/dotherside.git
synced 2025-02-12 04:26:43 +00:00
Fixed compilation and added stubs for index and parent functions
This commit is contained in:
parent
25f396ef46
commit
8079294e93
@ -50,6 +50,18 @@ public:
|
|||||||
/// @see QAbstractListModel::endRemoveRows
|
/// @see QAbstractListModel::endRemoveRows
|
||||||
virtual void publicEndRemoveRows() = 0;
|
virtual void publicEndRemoveRows() = 0;
|
||||||
|
|
||||||
|
/// @see QAbstractListModel::beginInsertColumns
|
||||||
|
virtual void publicBeginInsertColumns(const QModelIndex &index, int first, int last) = 0;
|
||||||
|
|
||||||
|
/// @see QAbstractListModel::endInsertColumns
|
||||||
|
virtual void publicEndInsertColumns() = 0;
|
||||||
|
|
||||||
|
/// @see QAbstractListModel::beginRemoveColumns
|
||||||
|
virtual void publicBeginRemoveColumns(const QModelIndex &index, int first, int last) = 0;
|
||||||
|
|
||||||
|
/// @see QAbstractListModel::endRemoveColumns
|
||||||
|
virtual void publicEndRemoveColumns() = 0;
|
||||||
|
|
||||||
/// @see QAbstractListModel::beginResetModel
|
/// @see QAbstractListModel::beginResetModel
|
||||||
virtual void publicBeginResetModel() = 0;
|
virtual void publicBeginResetModel() = 0;
|
||||||
|
|
||||||
|
@ -51,12 +51,28 @@ public:
|
|||||||
/// Return the data for the given role and section in the header with the specified orientation
|
/// Return the data for the given role and section in the header with the specified orientation
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||||
|
|
||||||
|
QModelIndex parent(const QModelIndex &child) const override;
|
||||||
|
|
||||||
/// Return the dModelPointer
|
/// Return the dModelPointer
|
||||||
void *modelObject();
|
void *modelObject();
|
||||||
|
|
||||||
/// Return the roleNames
|
/// Return the roleNames
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
|
/// Expose beginInsertRows
|
||||||
|
void publicBeginInsertColumns(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
|
/// Expose endInsertRows
|
||||||
|
void publicEndInsertColumns() override;
|
||||||
|
|
||||||
|
/// Expose beginRemoveRows
|
||||||
|
void publicBeginRemoveColumns(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
|
/// Expose endInsertRows
|
||||||
|
void publicEndRemoveColumns() override;
|
||||||
|
|
||||||
/// Expose beginInsertRows
|
/// Expose beginInsertRows
|
||||||
void publicBeginInsertRows(const QModelIndex &index, int first, int last) override;
|
void publicBeginInsertRows(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
@ -79,6 +95,7 @@ public:
|
|||||||
void publicDataChanged(const QModelIndex &topLeft,
|
void publicDataChanged(const QModelIndex &topLeft,
|
||||||
const QModelIndex &bottomRight,
|
const QModelIndex &bottomRight,
|
||||||
const QVector<int> &roles = QVector<int>()) override;
|
const QVector<int> &roles = QVector<int>()) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<DosIQObjectImpl> m_impl;
|
std::unique_ptr<DosIQObjectImpl> m_impl;
|
||||||
void *m_modelObject;
|
void *m_modelObject;
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
namespace DOS {
|
namespace DOS {
|
||||||
template <int, int>
|
template <int, int>
|
||||||
class DosQAbstractListModelWrapper : public QAbstractListModel, public DosIQAbstractItemModelImpl
|
class DosQAbstractItemModelWrapper : public QAbstractItemModel, public DosIQAbstractItemModelImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const QMetaObject staticMetaObject;
|
static const QMetaObject staticMetaObject;
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
DosQAbstractListModelWrapper(QObject *parent = nullptr);
|
DosQAbstractItemModelWrapper(QObject *parent = nullptr);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~DosQAbstractListModelWrapper();
|
~DosQAbstractItemModelWrapper();
|
||||||
|
|
||||||
/// @see DosIQObjectImpl::metaObject
|
/// @see DosIQObjectImpl::metaObject
|
||||||
const QMetaObject *metaObject() const override;
|
const QMetaObject *metaObject() const override;
|
||||||
@ -58,6 +58,12 @@ public:
|
|||||||
/// @see QAbstractListModel::roleNames
|
/// @see QAbstractListModel::roleNames
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
|
/// @see QAbstractItemModel::index
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||||
|
|
||||||
|
/// @see QAbstractItemModel::parent
|
||||||
|
QModelIndex parent(const QModelIndex &child) const override;
|
||||||
|
|
||||||
/// @see DosIQAbstractListModelImpl::publicBeginInsertRows
|
/// @see DosIQAbstractListModelImpl::publicBeginInsertRows
|
||||||
void publicBeginInsertRows(const QModelIndex &index, int first, int last) override;
|
void publicBeginInsertRows(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
@ -70,6 +76,18 @@ public:
|
|||||||
/// @see DosIQAbstractListModelImpl::publicEndRemoveRows
|
/// @see DosIQAbstractListModelImpl::publicEndRemoveRows
|
||||||
void publicEndRemoveRows() override;
|
void publicEndRemoveRows() override;
|
||||||
|
|
||||||
|
/// @see DosIQAbstractListModelImpl::publicBeginInsertColumns
|
||||||
|
void publicBeginInsertColumns(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
|
/// @see DosIQAbstractListModelImpl::publicEndInsertColumns
|
||||||
|
void publicEndInsertColumns() override;
|
||||||
|
|
||||||
|
/// @see DosIQAbstractListModelImpl::publicBeginRemoveColumns
|
||||||
|
void publicBeginRemoveColumns(const QModelIndex &index, int first, int last) override;
|
||||||
|
|
||||||
|
/// @see DosIQAbstractListModelImpl::publicEndRemoveColumns
|
||||||
|
void publicEndRemoveColumns() override;
|
||||||
|
|
||||||
/// @see DosIQAbstractListModelImpl::publicBeginResetModel
|
/// @see DosIQAbstractListModelImpl::publicBeginResetModel
|
||||||
void publicBeginResetModel() override;
|
void publicBeginResetModel() override;
|
||||||
|
|
||||||
@ -89,17 +107,17 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
const QMetaObject DosQAbstractListModelWrapper<N, M>::staticMetaObject = QAbstractListModel::staticMetaObject;
|
const QMetaObject DosQAbstractItemModelWrapper<N, M>::staticMetaObject = QAbstractListModel::staticMetaObject;
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
QmlRegisterType DosQAbstractListModelWrapper<N, M>::m_data;
|
QmlRegisterType DosQAbstractItemModelWrapper<N, M>::m_data;
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
int DosQAbstractListModelWrapper<N, M>::m_id = -1;
|
int DosQAbstractItemModelWrapper<N, M>::m_id = -1;
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
DosQAbstractListModelWrapper<N, M>::DosQAbstractListModelWrapper(QObject *parent)
|
DosQAbstractItemModelWrapper<N, M>::DosQAbstractItemModelWrapper(QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
, m_dObject(nullptr)
|
, m_dObject(nullptr)
|
||||||
, m_impl(nullptr)
|
, m_impl(nullptr)
|
||||||
{
|
{
|
||||||
@ -107,30 +125,30 @@ DosQAbstractListModelWrapper<N, M>::DosQAbstractListModelWrapper(QObject *parent
|
|||||||
m_data.createDObject(m_id, static_cast<QObject *>(this), &m_dObject, &impl);
|
m_data.createDObject(m_id, static_cast<QObject *>(this), &m_dObject, &impl);
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_impl = dynamic_cast<DosQAbstractItemModel *>(static_cast<QObject *>(impl));
|
m_impl = dynamic_cast<DosQAbstractItemModel *>(static_cast<QObject *>(impl));
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeInserted, this, &DosQAbstractListModelWrapper::beginInsertRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeInserted, this, &DosQAbstractItemModelWrapper::beginInsertRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsInserted, this, &DosQAbstractListModelWrapper::endInsertRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsInserted, this, &DosQAbstractItemModelWrapper::endInsertRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeRemoved, this, &DosQAbstractListModelWrapper::beginRemoveRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeRemoved, this, &DosQAbstractItemModelWrapper::beginRemoveRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsRemoved, this, &DosQAbstractListModelWrapper::endRemoveRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsRemoved, this, &DosQAbstractItemModelWrapper::endRemoveRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeMoved, this, &DosQAbstractListModelWrapper::beginMoveRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsAboutToBeMoved, this, &DosQAbstractItemModelWrapper::beginMoveRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::rowsMoved, this, &DosQAbstractListModelWrapper::endMoveRows);
|
QObject::connect(m_impl, &DosQAbstractItemModel::rowsMoved, this, &DosQAbstractItemModelWrapper::endMoveRows);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeInserted, this, &DosQAbstractListModelWrapper::beginInsertColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeInserted, this, &DosQAbstractItemModelWrapper::beginInsertColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsInserted, this, &DosQAbstractListModelWrapper::endInsertColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsInserted, this, &DosQAbstractItemModelWrapper::endInsertColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeRemoved, this, &DosQAbstractListModelWrapper::beginRemoveColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeRemoved, this, &DosQAbstractItemModelWrapper::beginRemoveColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsRemoved, this, &DosQAbstractListModelWrapper::endRemoveColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsRemoved, this, &DosQAbstractItemModelWrapper::endRemoveColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeMoved, this, &DosQAbstractListModelWrapper::beginMoveColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsAboutToBeMoved, this, &DosQAbstractItemModelWrapper::beginMoveColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::columnsMoved, this, &DosQAbstractListModelWrapper::endMoveColumns);
|
QObject::connect(m_impl, &DosQAbstractItemModel::columnsMoved, this, &DosQAbstractItemModelWrapper::endMoveColumns);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::modelAboutToBeReset, this, &DosQAbstractListModelWrapper::beginResetModel);
|
QObject::connect(m_impl, &DosQAbstractItemModel::modelAboutToBeReset, this, &DosQAbstractItemModelWrapper::beginResetModel);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::modelReset, this, &DosQAbstractListModelWrapper::endResetModel);
|
QObject::connect(m_impl, &DosQAbstractItemModel::modelReset, this, &DosQAbstractItemModelWrapper::endResetModel);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::dataChanged, this, &DosQAbstractListModelWrapper::dataChanged);
|
QObject::connect(m_impl, &DosQAbstractItemModel::dataChanged, this, &DosQAbstractItemModelWrapper::dataChanged);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::layoutAboutToBeChanged, this, &DosQAbstractListModelWrapper::layoutAboutToBeChanged);
|
QObject::connect(m_impl, &DosQAbstractItemModel::layoutAboutToBeChanged, this, &DosQAbstractItemModelWrapper::layoutAboutToBeChanged);
|
||||||
QObject::connect(m_impl, &DosQAbstractItemModel::layoutChanged, this, &DosQAbstractListModelWrapper::layoutChanged);
|
QObject::connect(m_impl, &DosQAbstractItemModel::layoutChanged, this, &DosQAbstractItemModelWrapper::layoutChanged);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
Q_ASSERT(m_dObject);
|
Q_ASSERT(m_dObject);
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
DosQAbstractListModelWrapper<N, M>::~DosQAbstractListModelWrapper()
|
DosQAbstractItemModelWrapper<N, M>::~DosQAbstractItemModelWrapper()
|
||||||
{
|
{
|
||||||
m_data.deleteDObject(m_id, m_dObject);
|
m_data.deleteDObject(m_id, m_dObject);
|
||||||
m_dObject = nullptr;
|
m_dObject = nullptr;
|
||||||
@ -139,137 +157,175 @@ DosQAbstractListModelWrapper<N, M>::~DosQAbstractListModelWrapper()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
const QMetaObject *DosQAbstractListModelWrapper<N, M>::metaObject() const
|
const QMetaObject *DosQAbstractItemModelWrapper<N, M>::metaObject() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->metaObject();
|
return m_impl->metaObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
int DosQAbstractListModelWrapper<N, M>::qt_metacall(QMetaObject::Call call, int index, void **args)
|
int DosQAbstractItemModelWrapper<N, M>::qt_metacall(QMetaObject::Call call, int index, void **args)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->qt_metacall(call, index, args);
|
return m_impl->qt_metacall(call, index, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
bool DosQAbstractListModelWrapper<N, M>::emitSignal(QObject *emitter, const QString &name, const std::vector<QVariant> &argumentsValues)
|
bool DosQAbstractItemModelWrapper<N, M>::emitSignal(QObject *emitter, const QString &name, const std::vector<QVariant> &argumentsValues)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->emitSignal(this, name, argumentsValues);
|
return m_impl->emitSignal(this, name, argumentsValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::setQmlRegisterType(QmlRegisterType data)
|
void DosQAbstractItemModelWrapper<N, M>::setQmlRegisterType(QmlRegisterType data)
|
||||||
{
|
{
|
||||||
m_data = std::move(data);
|
m_data = std::move(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::setStaticMetaObject(const QMetaObject &metaObject)
|
void DosQAbstractItemModelWrapper<N, M>::setStaticMetaObject(const QMetaObject &metaObject)
|
||||||
{
|
{
|
||||||
*(const_cast<QMetaObject *>(&staticMetaObject)) = metaObject;
|
*(const_cast<QMetaObject *>(&staticMetaObject)) = metaObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::setId(int id)
|
void DosQAbstractItemModelWrapper<N, M>::setId(int id)
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
int DosQAbstractListModelWrapper<N, M>::rowCount(const QModelIndex &parent) const
|
int DosQAbstractItemModelWrapper<N, M>::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->rowCount(parent);
|
return m_impl->rowCount(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
int DosQAbstractListModelWrapper<N, M>::columnCount(const QModelIndex &parent) const
|
int DosQAbstractItemModelWrapper<N, M>::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->columnCount(parent);
|
return m_impl->columnCount(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
QVariant DosQAbstractListModelWrapper<N, M>::data(const QModelIndex &index, int role) const
|
QVariant DosQAbstractItemModelWrapper<N, M>::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->data(index, role);
|
return m_impl->data(index, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
bool DosQAbstractListModelWrapper<N, M>::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool DosQAbstractItemModelWrapper<N, M>::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->setData(index, value, role);
|
return m_impl->setData(index, value, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
Qt::ItemFlags DosQAbstractListModelWrapper<N, M>::flags(const QModelIndex &index) const
|
Qt::ItemFlags DosQAbstractItemModelWrapper<N, M>::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->flags(index);
|
return m_impl->flags(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
QVariant DosQAbstractListModelWrapper<N, M>::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant DosQAbstractItemModelWrapper<N, M>::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->headerData(section, orientation, role);
|
return m_impl->headerData(section, orientation, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
QHash<int, QByteArray> DosQAbstractListModelWrapper<N, M>::roleNames() const
|
QHash<int, QByteArray> DosQAbstractItemModelWrapper<N, M>::roleNames() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_impl);
|
Q_ASSERT(m_impl);
|
||||||
return m_impl->roleNames();
|
return m_impl->roleNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicBeginInsertRows(const QModelIndex &index, int first, int last)
|
QModelIndex DosQAbstractItemModelWrapper<N, M>::index(int row, int column, const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_impl);
|
||||||
|
return m_impl->index(row, column, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
QModelIndex DosQAbstractItemModelWrapper<N, M>::parent(const QModelIndex &child) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_impl);
|
||||||
|
return m_impl->parent(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
void DosQAbstractItemModelWrapper<N, M>::publicBeginInsertRows(const QModelIndex &index, int first, int last)
|
||||||
{
|
{
|
||||||
m_impl->publicBeginInsertRows(index, first, last);
|
m_impl->publicBeginInsertRows(index, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicEndInsertRows()
|
void DosQAbstractItemModelWrapper<N, M>::publicEndInsertRows()
|
||||||
{
|
{
|
||||||
m_impl->publicEndInsertRows();
|
m_impl->publicEndInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicBeginRemoveRows(const QModelIndex &index, int first, int last)
|
void DosQAbstractItemModelWrapper<N, M>::publicBeginRemoveRows(const QModelIndex &index, int first, int last)
|
||||||
{
|
{
|
||||||
m_impl->publicBeginRemoveRows(index, first, last);
|
m_impl->publicBeginRemoveRows(index, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicEndRemoveRows()
|
void DosQAbstractItemModelWrapper<N, M>::publicEndRemoveRows()
|
||||||
{
|
{
|
||||||
m_impl->publicEndRemoveRows();
|
m_impl->publicEndRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicBeginResetModel()
|
void DosQAbstractItemModelWrapper<N, M>::publicBeginInsertColumns(const QModelIndex &index, int first, int last)
|
||||||
|
{
|
||||||
|
m_impl->publicBeginInsertColumns(index, first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
void DosQAbstractItemModelWrapper<N, M>::publicEndInsertColumns()
|
||||||
|
{
|
||||||
|
m_impl->publicEndInsertColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
void DosQAbstractItemModelWrapper<N, M>::publicBeginRemoveColumns(const QModelIndex &index, int first, int last)
|
||||||
|
{
|
||||||
|
m_impl->publicBeginRemoveColumns(index, first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
void DosQAbstractItemModelWrapper<N, M>::publicEndRemoveColumns()
|
||||||
|
{
|
||||||
|
m_impl->publicEndRemoveColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int N, int M>
|
||||||
|
void DosQAbstractItemModelWrapper<N, M>::publicBeginResetModel()
|
||||||
{
|
{
|
||||||
m_impl->publicBeginResetModel();
|
m_impl->publicBeginResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicEndResetModel()
|
void DosQAbstractItemModelWrapper<N, M>::publicEndResetModel()
|
||||||
{
|
{
|
||||||
m_impl->publicEndResetModel();
|
m_impl->publicEndResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
void DosQAbstractListModelWrapper<N, M>::publicDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
void DosQAbstractItemModelWrapper<N, M>::publicDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||||
{
|
{
|
||||||
m_impl->publicDataChanged(topLeft, bottomRight, roles);
|
m_impl->publicDataChanged(topLeft, bottomRight, roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int N, int M>
|
template<int N, int M>
|
||||||
const QmlRegisterType &DosQAbstractListModelWrapper<N, M>::qmlRegisterType()
|
const QmlRegisterType &DosQAbstractItemModelWrapper<N, M>::qmlRegisterType()
|
||||||
{
|
{
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
@ -277,7 +333,7 @@ const QmlRegisterType &DosQAbstractListModelWrapper<N, M>::qmlRegisterType()
|
|||||||
namespace DQALMW {
|
namespace DQALMW {
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
using RegisterTypeQObject = DosQAbstractListModelWrapper<N, 0>;
|
using RegisterTypeQObject = DosQAbstractItemModelWrapper<N, 0>;
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
int dosQmlRegisterType(QmlRegisterType args)
|
int dosQmlRegisterType(QmlRegisterType args)
|
||||||
@ -318,7 +374,7 @@ int dosQmlRegisterType(QmlRegisterType args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
using RegisterSingletonTypeQObject = DosQAbstractListModelWrapper<N, 1>;
|
using RegisterSingletonTypeQObject = DosQAbstractItemModelWrapper<N, 1>;
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
QObject *singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
QObject *singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
|
@ -93,6 +93,16 @@ QVariant DosQAbstractItemModel::headerData(int section, Qt::Orientation orientat
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndex DosQAbstractItemModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex DosQAbstractItemModel::parent(const QModelIndex &child) const
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
void *DosQAbstractItemModel::modelObject()
|
void *DosQAbstractItemModel::modelObject()
|
||||||
{
|
{
|
||||||
return m_modelObject;
|
return m_modelObject;
|
||||||
@ -105,6 +115,26 @@ QHash<int, QByteArray> DosQAbstractItemModel::roleNames() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DOS::DosQAbstractItemModel::publicBeginInsertColumns(const QModelIndex &index, int first, int last)
|
||||||
|
{
|
||||||
|
beginInsertColumns(index, first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DOS::DosQAbstractItemModel::publicEndInsertColumns()
|
||||||
|
{
|
||||||
|
endInsertColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DOS::DosQAbstractItemModel::publicBeginRemoveColumns(const QModelIndex &index, int first, int last)
|
||||||
|
{
|
||||||
|
beginRemoveColumns(index, first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DOS::DosQAbstractItemModel::publicEndRemoveColumns()
|
||||||
|
{
|
||||||
|
endRemoveColumns();
|
||||||
|
}
|
||||||
|
|
||||||
void DOS::DosQAbstractItemModel::publicBeginInsertRows(const QModelIndex &index, int first, int last)
|
void DOS::DosQAbstractItemModel::publicBeginInsertRows(const QModelIndex &index, int first, int last)
|
||||||
{
|
{
|
||||||
beginInsertRows(index, first, last);
|
beginInsertRows(index, first, last);
|
||||||
|
@ -12,7 +12,7 @@ namespace
|
|||||||
|
|
||||||
VoidPointer initializeMetaObject()
|
VoidPointer initializeMetaObject()
|
||||||
{
|
{
|
||||||
void* superClassMetaObject = dos_qabstractlistmodel_qmetaobject();
|
void* superClassMetaObject = dos_qabstractitemmodel_qmetaobject();
|
||||||
|
|
||||||
// Signals
|
// Signals
|
||||||
::SignalDefinition signalDefinitionArray[1];
|
::SignalDefinition signalDefinitionArray[1];
|
||||||
@ -64,7 +64,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
MockQAbstractItemModel::MockQAbstractItemModel()
|
MockQAbstractItemModel::MockQAbstractItemModel()
|
||||||
: m_vptr(dos_qabstractlistmodel_create(this, metaObject(), &onSlotCalled, &onRowCountCalled,
|
: m_vptr(dos_qabstractitemmodel_create(this, metaObject(), &onSlotCalled, &onRowCountCalled,
|
||||||
&onColumnCountCalled, &onDataCalled, &onSetDataCalled,
|
&onColumnCountCalled, &onDataCalled, &onSetDataCalled,
|
||||||
&onRoleNamesCalled, &onFlagsCalled, &onHeaderDataCalled), &dos_qobject_delete)
|
&onRoleNamesCalled, &onFlagsCalled, &onHeaderDataCalled), &dos_qobject_delete)
|
||||||
, m_names({"John", "Mary", "Andy", "Anna"})
|
, m_names({"John", "Mary", "Andy", "Anna"})
|
||||||
@ -176,7 +176,7 @@ void MockQAbstractItemModel::onSetDataCalled(void *selfVPtr, const DosQModelInde
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self->m_names[row] = toStringFromQVariant(value);
|
self->m_names[row] = toStringFromQVariant(value);
|
||||||
dos_qabstractlistmodel_dataChanged(self->data(), index, index, 0, 0);
|
dos_qabstractitemmodel_dataChanged(self->data(), index, index, 0, 0);
|
||||||
|
|
||||||
*result = true;
|
*result = true;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <DOtherSide/DosQAbstractItemModel.h>
|
#include <DOtherSide/DosQAbstractItemModel.h>
|
||||||
|
|
||||||
#include "MockQObject.h"
|
#include "MockQObject.h"
|
||||||
#include "MockQAbstractListModel.h"
|
#include "MockQAbstractItemModel.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace DOS;
|
using namespace DOS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user