2016-01-04 23:03:57 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Qt
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
// DOtherSide
|
|
|
|
#include "DOtherSide/DOtherSideTypes.h"
|
2016-01-23 18:40:17 +01:00
|
|
|
#include "DOtherSide/DosIQObjectImpl.h"
|
|
|
|
#include "DOtherSide/OnSlotExecutedHandler.h"
|
2016-01-04 23:03:57 +01:00
|
|
|
|
|
|
|
namespace DOS
|
|
|
|
{
|
|
|
|
|
2016-01-23 18:40:17 +01:00
|
|
|
class DosQAbstractListModel : public QAbstractListModel, public DosIQObjectImpl
|
2016-01-04 23:03:57 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor
|
2016-01-07 12:04:40 +01:00
|
|
|
DosQAbstractListModel(void* modelObject,
|
2016-01-23 18:40:17 +01:00
|
|
|
DosIQMetaObjectPtr metaObject,
|
2016-01-07 17:16:37 +01:00
|
|
|
OnSlotExecuted onSlotExecuted,
|
2016-01-07 17:06:13 +01:00
|
|
|
RowCountCallback rowCountCallback,
|
|
|
|
ColumnCountCallback columnCountCallback,
|
|
|
|
DataCallback dataCallback,
|
|
|
|
SetDataCallback setDataCallback,
|
|
|
|
RoleNamesCallback roleNamesCallback,
|
|
|
|
FlagsCallback flagsCallback,
|
|
|
|
HeaderDataCallback headerDataCallback);
|
2016-01-04 23:03:57 +01:00
|
|
|
|
|
|
|
/// @see IDynamicQObject::emitSignal
|
|
|
|
bool emitSignal(const QString &name, const std::vector<QVariant> &argumentsValues) override;
|
|
|
|
|
2016-01-16 20:19:48 +01:00
|
|
|
/// @see QAbstractListModel::metaObject()
|
|
|
|
const QMetaObject *metaObject() const override;
|
|
|
|
|
|
|
|
/// @see QAbstractListModel::qt_metacall
|
|
|
|
int qt_metacall(QMetaObject::Call, int, void **) override;
|
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// Return the model's row count
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
2016-01-08 19:31:33 +01:00
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// Return the model's column count
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
2016-01-08 19:31:33 +01:00
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// Return the QVariant at the given index
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
/// Sets the QVariant value at the given index and role
|
|
|
|
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
2016-01-08 19:31:33 +01:00
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// Return the item flags for the given index
|
|
|
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
2016-01-08 19:31:33 +01:00
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// 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;
|
2016-01-08 19:31:33 +01:00
|
|
|
|
2016-01-04 23:03:57 +01:00
|
|
|
/// Return the dModelPointer
|
|
|
|
void* modelObject();
|
|
|
|
|
|
|
|
/// Return the roleNames
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
/// Expose beginInsertRows
|
|
|
|
void publicBeginInsertRows(const QModelIndex& index, int first, int last);
|
|
|
|
|
|
|
|
/// Expose endInsertRows
|
|
|
|
void publicEndInsertRows();
|
|
|
|
|
|
|
|
/// Expose beginRemoveRows
|
|
|
|
void publicBeginRemoveRows(const QModelIndex& index, int first, int last);
|
|
|
|
|
|
|
|
/// Expose endInsertRows
|
|
|
|
void publicEndRemoveRows();
|
|
|
|
|
|
|
|
/// Expose beginResetModel
|
|
|
|
void publicBeginResetModel();
|
|
|
|
|
|
|
|
/// Expose endResetModel
|
|
|
|
void publicEndResetModel();
|
|
|
|
|
|
|
|
/// Expose dataChanged
|
|
|
|
void publicDataChanged(const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight,
|
|
|
|
const QVector<int>& roles = QVector<int>());
|
|
|
|
|
|
|
|
private:
|
2016-01-23 18:40:17 +01:00
|
|
|
std::unique_ptr<DosIQObjectImpl> m_impl;
|
2016-01-04 23:03:57 +01:00
|
|
|
void* m_modelObject;
|
|
|
|
RowCountCallback m_rowCountCallback;
|
|
|
|
ColumnCountCallback m_columnCountCallback;
|
|
|
|
DataCallback m_dataCallback;
|
|
|
|
SetDataCallback m_setDataCallback;
|
|
|
|
RoleNamesCallback m_roleNamesCallback;
|
|
|
|
FlagsCallback m_flagsCallback;
|
|
|
|
HeaderDataCallback m_headerDataCallback;
|
|
|
|
};
|
|
|
|
|
2016-01-07 12:04:40 +01:00
|
|
|
} // namespace DOS
|