1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-17 11:26:26 +02:00

42 lines
883 B
C++
Raw Normal View History

2016-12-11 16:09:39 +00:00
#include "notemodel.h"
2016-12-12 22:33:33 +00:00
jop::NoteModel::NoteModel()
2016-12-11 16:09:39 +00:00
{
2016-12-12 22:33:33 +00:00
2016-12-11 16:09:39 +00:00
}
2016-12-12 22:33:33 +00:00
int jop::NoteModel::rowCount(const QModelIndex &parent) const {
2016-12-29 21:51:10 +01:00
Q_UNUSED(parent);
2016-12-12 22:33:33 +00:00
return collection_.count();
2016-12-11 16:09:39 +00:00
}
2016-12-12 22:33:33 +00:00
QVariant jop::NoteModel::data(const QModelIndex &index, int role) const {
if (index.row() < 0 || index.row() >= rowCount()) return QVariant();
// Note note = collection_.at(index.row());
2016-12-12 22:33:33 +00:00
// if (role == IdRole) {
// return QVariant(note.id());
// }
2016-12-12 22:33:33 +00:00
// return QVariant(note.title());
2016-12-11 16:09:39 +00:00
}
2016-12-12 22:33:33 +00:00
void jop::NoteModel::setFolderId(const QString &v) {
folderId_ = v;
}
void jop::NoteModel::setCollection(jop::NoteCollection &noteCollection) {
beginResetModel();
collection_ = noteCollection;
endResetModel();
}
QHash<int, QByteArray> jop::NoteModel::roleNames() const {
2016-12-11 16:09:39 +00:00
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
// roles[TitleRole] = "title";
// roles[UuidRole] = "uuid";
return roles;
}