|
|
@ -7,15 +7,16 @@ |
|
|
|
#include <QPen> |
|
|
|
#include <QPen> |
|
|
|
#include <QWidget> |
|
|
|
#include <QWidget> |
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QMouseEvent> |
|
|
|
|
|
|
|
#include <QKeyEvent> |
|
|
|
#include <QTimer> |
|
|
|
#include <QTimer> |
|
|
|
#include <QTime> |
|
|
|
#include <QTime> |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
|
|
#define clRed 0x00FF0000 |
|
|
|
#define clRed 0x00FF0000 |
|
|
|
#define clGreen 0x0000FF00 |
|
|
|
#define clGreen 0x0000FF00 |
|
|
|
#define clBlue 0x000000FF |
|
|
|
#define clBlue 0x000000FF |
|
|
|
#define clBlack 0x00000000 |
|
|
|
#define clBlack 0x00000000 |
|
|
|
#define clWhite 0x00FFFFFF |
|
|
|
#define clWhite 0x00FFFFFF |
|
|
|
|
|
|
|
|
|
|
|
class QTSGraph : public QMainWindow |
|
|
|
class QTSGraph : public QMainWindow |
|
|
|
{ |
|
|
|
{ |
|
|
@ -25,11 +26,14 @@ public: |
|
|
|
QTSGraph(int w = 640, int h = 480, int x = -1, int y = -1, QWidget *parent = nullptr); |
|
|
|
QTSGraph(int w = 640, int h = 480, int x = -1, int y = -1, QWidget *parent = nullptr); |
|
|
|
~QTSGraph(); |
|
|
|
~QTSGraph(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Circle(int x, int y, int radius); |
|
|
|
void Delay(int ms = 1000); |
|
|
|
void Delay(int ms = 1000); |
|
|
|
void Line(int x1, int y1, int x2, int y2); |
|
|
|
void Line(int x1, int y1, int x2, int y2); |
|
|
|
|
|
|
|
bool KeyPressed(); |
|
|
|
bool MouseClicked(); |
|
|
|
bool MouseClicked(); |
|
|
|
void OutTextXY(int x, int y, std::string s); |
|
|
|
void OutTextXY(int x, int y, std::string caption); |
|
|
|
void PutPixel(int x, int y, QRgb c = 0x00000000, int PenWidth = 1); |
|
|
|
void PutPixel(int x, int y, QRgb c = 0x00000000, int PenWidth = 1); |
|
|
|
|
|
|
|
int ReadKey(); |
|
|
|
void Rectangle(int x1, int y1, int x2, int y2); |
|
|
|
void Rectangle(int x1, int y1, int x2, int y2); |
|
|
|
void SetColor(QRgb c); |
|
|
|
void SetColor(QRgb c); |
|
|
|
void SetPenStyle(int PenWidth, int PenStyle = 1); // Толщина и стиль линии
|
|
|
|
void SetPenStyle(int PenWidth, int PenStyle = 1); // Толщина и стиль линии
|
|
|
@ -50,10 +54,13 @@ private: |
|
|
|
QPixmap Canvas; |
|
|
|
QPixmap Canvas; |
|
|
|
QTimer *StartTimer; |
|
|
|
QTimer *StartTimer; |
|
|
|
bool EventMouseClicked = false; |
|
|
|
bool EventMouseClicked = false; |
|
|
|
|
|
|
|
bool EventKeyPressed = false; |
|
|
|
|
|
|
|
int IDPressedKey = -1; |
|
|
|
void PaintBox(); |
|
|
|
void PaintBox(); |
|
|
|
QPen Pen; |
|
|
|
QPen Pen; |
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
protected: |
|
|
|
void paintEvent(QPaintEvent *event) override; |
|
|
|
void paintEvent(QPaintEvent *event) override; |
|
|
|
void mousePressEvent(QMouseEvent *event) override; |
|
|
|
void mousePressEvent(QMouseEvent *event) override; |
|
|
|
|
|
|
|
void keyPressEvent(QKeyEvent *event) override; |
|
|
|
}; |
|
|
|
}; |
|
|
|