-
Notifications
You must be signed in to change notification settings - Fork 0
/
QFrameMark.h
96 lines (74 loc) · 1.7 KB
/
QFrameMark.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef QFRAMEMARK_H
#define QFRAMEMARK_H
#include <QtGui>
#include <QLabel>
#include <QStyle>
#include<QList>
#include <QFrame>
#ifndef QMARK_H
#define QMARK_H
#include <QtGui>
#include <QStyle>
#include<QList>
#include <QFrame>
class QMark : public QFrame
{
Q_OBJECT
public:
explicit QMark(QWidget *parent = nullptr);
Qt::GlobalColor color;
QString markName;
private:
enum class typOrientation
{
vertical,
horizontal
};
typOrientation orientation;
QPoint offset;
protected:
void paintEvent(QPaintEvent *ev);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
signals:
void posChanged(int, QString);
public slots:
};
#endif // QMARK_H
class QFrameMark : public QFrame
{
Q_OBJECT
public:
explicit QFrameMark(QWidget *parent = nullptr);
void addMark(QString markName, double perc, Qt::GlobalColor color );
void updatePosMark(QString markName, double perc );
void removeMark(QString markName );
void clearAllMark( );
private:
struct markStruct {
QString markName;
double perc;
Qt::GlobalColor color;
QMark *Qm;
};
QList<markStruct>markList;
int findMark( QString markName );
enum class typOrientation
{
vertical,
horizontal
};
typOrientation orientation;
protected:
void paintEvent(QPaintEvent *ev);
void resizeEvent( QResizeEvent * event);
void drawMark(int pos, Qt::GlobalColor color );
int percToPos( double perc );
double posToPerc( int pos );
void moveMark( int idx );
signals:
void percChanged(double, QString);
public slots:
void slotPosChanged(int, QString);
};
#endif // QFRAMEMARK_H