2f6b55128
김태훈
다중 요리 구현
|
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#ifndef MULTICOOKVIEW_H
#define MULTICOOKVIEW_H
#include <QWidget>
#include <QPixmap>
#include <QTimer>
#include "multicookcontainer.h"
#include "multicooktimebar.h"
class MultiCookView : public QWidget
{
Q_OBJECT
public:
explicit MultiCookView(QWidget *parent = 0);
void setContainer(MultiCookContainer *container);
void setTimeBar(MultiCookTimeBar *bar);
signals:
void clicked(int);
public slots:
void showNow();
void showNext();
void showPrev();
void updateView();
protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void paintEvent(QPaintEvent *event);
virtual void resizeEvent(QResizeEvent *event);
private:
// helper methods
QList<QRect> calcRects();
int calcSlot(int x, int y);
void paintGrids(QPainter &painter);
void paintBars(QPainter &painter);
void paintCurrentTime(QPainter &painter);
void paintBar(QPainter &painter, QRect r);
int currentTimePosition();
bool nothingOnRight();
MultiCookContainer *container;
MultiCookTimeBar *bar;
QList<QRect> rects;
int timePosition;
// for click signal
int pressedSlot;
QPixmap barPixmap;
QTimer checkTimer;
private slots:
void check();
};
#endif // MULTICOOKVIEW_H
|