Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
tip_of_the_day.h
Go to the documentation of this file.
1
6
7#ifndef TIP_OF_DAY_H
8#define TIP_OF_DAY_H
9
10#include <QAbstractListModel>
11#include <QDate>
12
14{
15public:
16 explicit TipOfTheDay(QString _title, QString _content, QString _imagePath, QDate _date);
17 [[nodiscard]] QString getTitle() const
18 {
19 return title;
20 }
21 [[nodiscard]] QString getContent() const
22 {
23 return content;
24 }
25 [[nodiscard]] QString getImagePath() const
26 {
27 return imagePath;
28 }
29 [[nodiscard]] QDate getDate() const
30 {
31 return date;
32 }
33
34private:
36 QDate date;
37};
38
39class TipsOfTheDay : public QAbstractListModel
40{
41 Q_OBJECT
42public:
50
51 explicit TipsOfTheDay(QString xmlPath, QObject *parent = nullptr);
52 ~TipsOfTheDay() override;
53 TipOfTheDay getTip(int tipId);
54 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
55 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
56
57private:
58 QList<TipOfTheDay> *tipList;
59};
60
61#endif
Definition tip_of_the_day.h:14
QString getTitle() const
Definition tip_of_the_day.h:17
QString getContent() const
Definition tip_of_the_day.h:21
QDate getDate() const
Definition tip_of_the_day.h:29
QString content
Definition tip_of_the_day.h:35
QDate date
Definition tip_of_the_day.h:36
QString getImagePath() const
Definition tip_of_the_day.h:25
QString imagePath
Definition tip_of_the_day.h:35
QString title
Definition tip_of_the_day.h:35
TipOfTheDay(QString _title, QString _content, QString _imagePath, QDate _date)
Definition tip_of_the_day.cpp:12
TipOfTheDay getTip(int tipId)
Definition tip_of_the_day.cpp:94
~TipsOfTheDay() override
Definition tip_of_the_day.cpp:69
Columns
Definition tip_of_the_day.h:44
@ ContentColumn
Definition tip_of_the_day.h:46
@ TitleColumn
Definition tip_of_the_day.h:45
@ ImagePathColumn
Definition tip_of_the_day.h:47
@ DateColumn
Definition tip_of_the_day.h:48
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition tip_of_the_day.cpp:99
QList< TipOfTheDay > * tipList
Definition tip_of_the_day.h:58
TipsOfTheDay(QString xmlPath, QObject *parent=nullptr)
Definition tip_of_the_day.cpp:17
QVariant data(const QModelIndex &index, int role) const override
Definition tip_of_the_day.cpp:74