@@ -34,18 +34,13 struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |||
|
34 | 34 | case Column::Name: |
|
35 | 35 | return event->getName(); |
|
36 | 36 | case Column::TStart: |
|
37 |
return DateUtils::dateTime(event->getTStart()) |
|
|
37 | return nbEventProducts(event) > 0 ? DateUtils::dateTime(event->getTStart()) | |
|
38 | : QVariant{}; | |
|
38 | 39 | case Column::TEnd: |
|
39 |
return DateUtils::dateTime(event->getTEnd()) |
|
|
40 | case Column::Product: { | |
|
41 | auto eventProductsIt = m_EventProducts.find(event.get()); | |
|
42 | if (eventProductsIt != m_EventProducts.cend()) { | |
|
43 | return QString::number(m_EventProducts.at(event.get()).count()) + " product(s)"; | |
|
44 | } | |
|
45 | else { | |
|
46 | return "0 product"; | |
|
47 | } | |
|
48 | } | |
|
40 | return nbEventProducts(event) > 0 ? DateUtils::dateTime(event->getTEnd()) | |
|
41 | : QVariant{}; | |
|
42 | case Column::Product: | |
|
43 | return QString::number(nbEventProducts(event)) + " product(s)"; | |
|
49 | 44 | case Column::Tags: { |
|
50 | 45 | QString tagList; |
|
51 | 46 | auto tags = event->getTags(); |
@@ -71,6 +66,17 struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |||
|
71 | 66 | } |
|
72 | 67 | } |
|
73 | 68 | |
|
69 | int nbEventProducts(const std::shared_ptr<DBEvent> &event) const | |
|
70 | { | |
|
71 | auto eventProductsIt = m_EventProducts.find(event.get()); | |
|
72 | if (eventProductsIt != m_EventProducts.cend()) { | |
|
73 | return m_EventProducts.at(event.get()).count(); | |
|
74 | } | |
|
75 | else { | |
|
76 | return 0; | |
|
77 | } | |
|
78 | } | |
|
79 | ||
|
74 | 80 | QVariant eventProductData(int col, const std::shared_ptr<DBEventProduct> &eventProduct) const |
|
75 | 81 | { |
|
76 | 82 | switch (static_cast<Column>(col)) { |
General Comments 0
You need to be logged in to leave comments.
Login now