-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminmaxdrawdialog.h
74 lines (63 loc) · 2.1 KB
/
minmaxdrawdialog.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
#ifndef MINMAXDRAWDIALOG_H
#define MINMAXDRAWDIALOG_H
#include <QWidget>
#include <QWidget>
#include <QPainter>
#include <QLinkedList>
#include <drawdialog.h>
namespace Ui {
class MinMaxDrawDialog;
}
class MinMaxDrawDialog : public QWidget
{
Q_OBJECT
private:
Ui::MinMaxDrawDialog *ui;
QSize m_size;//size of coordinate plain
QSize m_windowSize;//size of paint window
qreal m_scale;//size multiplayer for scaling
QLinkedList<GraphicElement *> m_whatToDrawList;
QColor m_textColor;
QColor m_linesColor;
static qreal toQtY(qreal Y);
static qreal fromQtY(qreal Y);
bool m_drawMinMax;//if we allready ready to draw min and max line
QPair<QPointF, QPointF> m_minLineAnswer;
QPair<QPointF, QPointF> m_maxLineAnswer;
QPair<QPointF, QPointF> m_minLineUserAnswer;
QPair<QPointF, QPointF> m_maxLineUserAnswer;
QLinkedList<QPair<QPointF, QPointF> > m_solutionPoints;
enum{
indent = 20 //отступ в пикселях от краев окна для надписей и т.д.
};
void drawLine(const double x, const double y, const double c);
QLineF getQLine(DrawLine Line);
QLineF getOrdinaryLine(DrawLine Line);
void findMin();
void findMax();
DrawLine Zfunction;
QLinkedList<QPair<QPointF, QPointF> > findSolutionPolygon(QLinkedList<GraphicElement *> *drawList);
void resetAllChanges();
bool m_resetAllChanges;
public:
explicit MinMaxDrawDialog(QWidget *parent = 0);
explicit MinMaxDrawDialog(const QSize size, QWidget *parent = 0);
~MinMaxDrawDialog();
void setScale(qreal scale);
void setTextColor(QColor color);
void setLinesColor(QColor color);
QSize sizeHint() const;
bool check();
protected:
void paintEvent(QPaintEvent *e);
public slots:
void drawTheProblem(double **array, quint8 rowsCount);
void nextMin();
void nextMax();
void setCorrectAnswer();
signals:
void userAnswerFalse();
void result(QPointF, QPointF, qreal minZ, qreal maxZ);
private slots:
};
#endif // MINMAXDRAWDIALOG_H