-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstractfunction.h
79 lines (58 loc) · 1.73 KB
/
abstractfunction.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
#ifndef ABSTRACTFUNCTION_H
#define ABSTRACTFUNCTION_H
#include <QWidget>
#include <QObject>
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
#include <QComboBox>
#include <QString>
#include <QCheckBox>
#include <QVector>
#include <QPainter>
#include <QColorDialog>
#include <QLineEdit>
#include <QDebug>
#include <iostream>
#include "defines.h"
class AbstractFunction : public QWidget
{
Q_OBJECT
public:
explicit AbstractFunction(const QString& _id, QWidget* parent = nullptr);
virtual ~AbstractFunction();
void new_select(AbstractFunction* new_func);
virtual std::pair<unsigned, QPointF*> getPoints(float min, float max) = 0;
virtual float getOnePoint(float x) = 0;
virtual QString getFormula() const = 0;
inline bool isDrawable() const { return check->isChecked(); }
inline QString getID() const {return id;}
inline void setID(const QString& _id) {id=_id;}
inline QColor getColor() const { return color; }
inline bool isSelected() const {return is_selected;}
static AbstractFunction* loadFunction(const QString&, QWidget* parent = nullptr) ;
public slots :
void choseColor();
void changeName();
void emit_delete_me();
signals :
void selected(AbstractFunction* );
void delete_me(AbstractFunction*);
void needUpdate();
protected :
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent*);
QString id;
bool is_selected;
QColor color;
QVBoxLayout* main_layout;
QHBoxLayout* top_layout;
QCheckBox* check;
QPushButton* color_button;
QIcon* icon_color;
QPixmap* pix_color;
QLineEdit* id_func;
QVBoxLayout* bottom_layout;
QPushButton* bdelete;
};
#endif // ABSTRACTFUNCTION_H