2024-11-09 15:05:14 +08:00
|
|
|
#include "comicitem.h"
|
|
|
|
|
|
|
|
ComicItem::ComicItem(QJsonObject jsonObj, const QString &name)
|
|
|
|
: QStandardItem(name)
|
|
|
|
{
|
|
|
|
setData(jsonObj["id"].toString(), IdRole);
|
|
|
|
setData(jsonObj["hash"].toString(), HashRole);
|
|
|
|
setData(jsonObj["num_pages"].toInt(), PageCountRole);
|
|
|
|
setData(jsonObj["current_page"].toInt(), CurrentPageRole);
|
|
|
|
setData(jsonObj["type"].toInt(), TypeRole);
|
2024-11-15 20:58:03 +08:00
|
|
|
setData(jsonObj["added"].toInteger(), AddedTimeRole);
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
2024-11-10 17:10:45 +08:00
|
|
|
|
|
|
|
QHash<int, QByteArray> ComicItem::roleNames()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
{Qt::DisplayRole, "display"},
|
|
|
|
{ComicItem::IdRole, "comicId"},
|
|
|
|
{ComicItem::HashRole, "hash"},
|
|
|
|
{ComicItem::PageCountRole, "pageCount"},
|
|
|
|
{ComicItem::CurrentPageRole, "currentPage"},
|
|
|
|
{ComicItem::TypeRole, "type"},
|
2024-11-15 20:58:03 +08:00
|
|
|
{ComicItem::AddedTimeRole, "addedTime"},
|
2024-11-10 17:10:45 +08:00
|
|
|
};
|
|
|
|
}
|