Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/itemdelegate.cpp
Show All 24 Lines | |||||
25 | #include "itemdelegate.h" | 25 | #include "itemdelegate.h" | ||
26 | 26 | | |||
27 | #include <QApplication> | 27 | #include <QApplication> | ||
28 | #include <QPainter> | 28 | #include <QPainter> | ||
29 | #include <QStyleOptionViewItem> | 29 | #include <QStyleOptionViewItem> | ||
30 | 30 | | |||
31 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
32 | 32 | | |||
33 | #include "domain/note.h" | | |||
34 | #include "domain/task.h" | 33 | #include "domain/task.h" | ||
35 | #include "presentation/pagemodel.h" | 34 | #include "presentation/pagemodel.h" | ||
36 | #include "presentation/querytreemodelbase.h" | 35 | #include "presentation/querytreemodelbase.h" | ||
37 | #include "utils/datetime.h" | 36 | #include "utils/datetime.h" | ||
38 | 37 | | |||
39 | using namespace Widgets; | 38 | using namespace Widgets; | ||
40 | 39 | | |||
41 | ItemDelegate::ItemDelegate(QObject *parent) | 40 | ItemDelegate::ItemDelegate(QObject *parent) | ||
Show All 24 Lines | 64 | { | |||
66 | const auto data = index.data(Presentation::QueryTreeModelBase::ObjectRole); | 65 | const auto data = index.data(Presentation::QueryTreeModelBase::ObjectRole); | ||
67 | 66 | | |||
68 | auto task = Domain::Task::Ptr(); | 67 | auto task = Domain::Task::Ptr(); | ||
69 | auto artifact = data.value<Domain::Artifact::Ptr>(); | 68 | auto artifact = data.value<Domain::Artifact::Ptr>(); | ||
70 | if (artifact) { | 69 | if (artifact) { | ||
71 | task = artifact.dynamicCast<Domain::Task>(); | 70 | task = artifact.dynamicCast<Domain::Task>(); | ||
72 | } else { | 71 | } else { | ||
73 | task = data.value<Domain::Task::Ptr>(); | 72 | task = data.value<Domain::Task::Ptr>(); | ||
74 | auto note = data.value<Domain::Note::Ptr>(); | | |||
75 | artifact = task ? task.staticCast<Domain::Artifact>() | 73 | artifact = task ? task.staticCast<Domain::Artifact>() | ||
76 | : note.staticCast<Domain::Artifact>(); | 74 | : Domain::Artifact::Ptr(); | ||
77 | } | 75 | } | ||
78 | 76 | | |||
79 | auto opt = QStyleOptionViewItem(option); | 77 | auto opt = QStyleOptionViewItem(option); | ||
80 | initStyleOption(&opt, index); | 78 | initStyleOption(&opt, index); | ||
81 | const auto widget = opt.widget; | 79 | const auto widget = opt.widget; | ||
82 | const auto style = widget ? widget->style() : QApplication::style(); | 80 | const auto style = widget ? widget->style() : QApplication::style(); | ||
83 | 81 | | |||
84 | const auto isDone = task ? task->isDone() : false; | 82 | const auto isDone = task ? task->isDone() : false; | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |