Changeset View
Changeset View
Standalone View
Standalone View
libdiscover/ReviewsBackend/ReviewsModel.cpp
Show All 40 Lines | 39 | { | |||
---|---|---|---|---|---|
41 | roles.insert(ShouldShow, "shouldShow"); | 41 | roles.insert(ShouldShow, "shouldShow"); | ||
42 | roles.insert(Reviewer, "reviewer"); | 42 | roles.insert(Reviewer, "reviewer"); | ||
43 | roles.insert(CreationDate, "date"); | 43 | roles.insert(CreationDate, "date"); | ||
44 | roles.insert(UsefulnessTotal, "usefulnessTotal"); | 44 | roles.insert(UsefulnessTotal, "usefulnessTotal"); | ||
45 | roles.insert(UsefulnessFavorable, "usefulnessFavorable"); | 45 | roles.insert(UsefulnessFavorable, "usefulnessFavorable"); | ||
46 | roles.insert(UsefulChoice, "usefulChoice"); | 46 | roles.insert(UsefulChoice, "usefulChoice"); | ||
47 | roles.insert(Rating, "rating"); | 47 | roles.insert(Rating, "rating"); | ||
48 | roles.insert(Summary, "summary"); | 48 | roles.insert(Summary, "summary"); | ||
49 | roles.insert(Depth, "depth"); | ||||
49 | return roles; | 50 | return roles; | ||
50 | } | 51 | } | ||
51 | 52 | | |||
52 | QVariant ReviewsModel::data(const QModelIndex& index, int role) const | 53 | QVariant ReviewsModel::data(const QModelIndex& index, int role) const | ||
53 | { | 54 | { | ||
54 | if(!index.isValid()) | 55 | if(!index.isValid()) | ||
55 | return QVariant(); | 56 | return QVariant(); | ||
56 | switch(role) { | 57 | switch(role) { | ||
Show All 10 Lines | |||||
67 | case UsefulnessFavorable: | 68 | case UsefulnessFavorable: | ||
68 | return m_reviews.at(index.row())->usefulnessFavorable(); | 69 | return m_reviews.at(index.row())->usefulnessFavorable(); | ||
69 | case UsefulChoice: | 70 | case UsefulChoice: | ||
70 | return m_reviews.at(index.row())->usefulChoice(); | 71 | return m_reviews.at(index.row())->usefulChoice(); | ||
71 | case Rating: | 72 | case Rating: | ||
72 | return m_reviews.at(index.row())->rating(); | 73 | return m_reviews.at(index.row())->rating(); | ||
73 | case Summary: | 74 | case Summary: | ||
74 | return m_reviews.at(index.row())->summary(); | 75 | return m_reviews.at(index.row())->summary(); | ||
76 | case Depth: | ||||
77 | return m_reviews.at(index.row())->getMetadata(QStringLiteral("NumberOfParents")).toInt(); | ||||
75 | } | 78 | } | ||
76 | return QVariant(); | 79 | return QVariant(); | ||
77 | } | 80 | } | ||
78 | 81 | | |||
79 | int ReviewsModel::rowCount(const QModelIndex& parent) const | 82 | int ReviewsModel::rowCount(const QModelIndex& parent) const | ||
80 | { | 83 | { | ||
81 | if(parent.isValid()) | 84 | if(parent.isValid()) | ||
82 | return 0; | 85 | return 0; | ||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |