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

49 lines
1.0 KiB
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 {
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_.itemAt(index.row());
return QVariant(note.title());
// int from = std::max(0, index.row() - 16);
// int to = from + 32;
// QList<Note> list = noteService_.overviewList(folderId_, from, to, "title ASC");
2016-12-11 16:09:39 +00:00
return QVariant();
}
2016-12-12 22:33:33 +00:00
void jop::NoteModel::setFolderId(const QString &v) {
folderId_ = v;
}
void jop::NoteModel::setService(jop::NoteService &v) {
noteService_ = 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;
}