basemodel.h 916 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#ifndef NOTESMODEL_H
#define NOTESMODEL_H

#include <QAbstractListModel>
#include <QList>
#include "owl.h"

class Notes;
class BaseList;
class BaseModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY(BaseList *list READ getList WRITE setList)

public:
    explicit BaseModel(QObject *parent = nullptr);

    // Basic functionality:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    // Editable:
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;

    Qt::ItemFlags flags(const QModelIndex& index) const override;

    virtual QHash<int, QByteArray> roleNames() const override;

    BaseList* getList() const;
    void setList(BaseList *value);

private:
    BaseList *mList;
signals:
    void listChanged();
};

#endif // NOTESMODEL_H