1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-26 12:02:59 +02:00
joplin/QtClient/JoplinQtClient/models/abstractlistmodel.h

53 lines
1022 B
C
Raw Normal View History

2017-01-12 21:33:56 +01:00
#ifndef ABSTRACTLISTMODEL_H
#define ABSTRACTLISTMODEL_H
#include <stable.h>
#include "models/basemodel.h"
namespace jop {
class AbstractListModel : public QAbstractListModel {
Q_OBJECT
public:
enum ModelRoles {
IdRole = Qt::UserRole + 1,
TitleRole,
RawRole
};
AbstractListModel();
int rowCount(const QModelIndex & parent = QModelIndex()) const;
//QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
// BaseModel atIndex(int index) const;
// BaseModel atIndex(const QModelIndex &index) const;
protected:
virtual BaseModel newBaseModel() const;
2017-01-12 21:33:56 +01:00
virtual int baseModelCount() const;
virtual BaseModel cacheGet(int index) const;
virtual void cacheSet(int index, const BaseModel& baseModel);
virtual bool cacheIsset(int index) const;
virtual void cacheClear();
2017-01-12 21:33:56 +01:00
private:
bool virtualItemShown_;
public slots:
void showVirtualItem();
bool virtualItemShown() const;
void hideVirtualItem();
QHash<int, QByteArray> roleNames() const;
};
}
#endif // ABSTRACTLISTMODEL_H