-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharticlebutton.h
46 lines (35 loc) · 931 Bytes
/
articlebutton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef ARTICLEBUTTON_H
#define ARTICLEBUTTON_H
#include <QWidget>
#include <QPushButton>
#include "article.h"
namespace Ui {
class ArticleButton;
}
enum class BackGroundColor {
Unset, White, Blue
};
class ArticleButton : public QWidget
{
Q_OBJECT
public:
ArticleButton(const Article &article, QWidget *parent = nullptr);
virtual ~ArticleButton() override;
int getIdx() const;
bool isChecked() const;
void setChecked(bool flag=false);
void setTitle(const QString &title);
void setContent(const QString &content);
qint64 getModifiedTime() const;
private:
Ui::ArticleButton *ui;
Article article;
signals:
void clicked(int idx);
protected:
bool checked_ = false;
BackGroundColor bColor = BackGroundColor::White;
virtual void paintEvent(QPaintEvent *event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
};
#endif // ARTICLEBUTTON_H