|
|
@ -34,6 +34,14 @@ QTSGraph::~QTSGraph() |
|
|
|
// Деструктор
|
|
|
|
// Деструктор
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::Circle(int x, int y, int radius) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QPainter painter(&Canvas); |
|
|
|
|
|
|
|
painter.setPen(Pen); |
|
|
|
|
|
|
|
painter.drawEllipse(x - radius, y - radius, radius * 2, radius * 2); |
|
|
|
|
|
|
|
update(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QTSGraph::MouseClicked() |
|
|
|
bool QTSGraph::MouseClicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool m = EventMouseClicked; |
|
|
|
bool m = EventMouseClicked; |
|
|
@ -41,11 +49,11 @@ bool QTSGraph::MouseClicked() |
|
|
|
return m; |
|
|
|
return m; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::OutTextXY(int x, int y, std::string s) |
|
|
|
void QTSGraph::OutTextXY(int x, int y, std::string caption) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPainter painter(&Canvas); |
|
|
|
QPainter painter(&Canvas); |
|
|
|
painter.setPen(Pen); |
|
|
|
painter.setPen(Pen); |
|
|
|
painter.drawText(x, y, QString::fromStdString(s)); |
|
|
|
painter.drawText(x, y, QString::fromStdString(caption)); |
|
|
|
update(); |
|
|
|
update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -57,6 +65,18 @@ void QTSGraph::PutPixel(int x, int y, QRgb c, int PenWidth) |
|
|
|
update(); |
|
|
|
update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int QTSGraph::ReadKey() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(IDPressedKey == -1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
while(!KeyPressed()) |
|
|
|
|
|
|
|
Delay(100); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int t = IDPressedKey; |
|
|
|
|
|
|
|
IDPressedKey = -1; |
|
|
|
|
|
|
|
return t; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::Rectangle(int x1, int y1, int x2, int y2) |
|
|
|
void QTSGraph::Rectangle(int x1, int y1, int x2, int y2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPainter painter(&Canvas); |
|
|
|
QPainter painter(&Canvas); |
|
|
@ -89,6 +109,13 @@ void QTSGraph::Line(int x1, int y1, int x2, int y2) |
|
|
|
update(); |
|
|
|
update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool QTSGraph::KeyPressed() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bool m = EventKeyPressed; |
|
|
|
|
|
|
|
EventKeyPressed = false; |
|
|
|
|
|
|
|
return m; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::slotStartTimer() |
|
|
|
void QTSGraph::slotStartTimer() |
|
|
|
{ |
|
|
|
{ |
|
|
|
StartTimer->stop(); |
|
|
|
StartTimer->stop(); |
|
|
@ -113,3 +140,13 @@ void QTSGraph::mousePressEvent(QMouseEvent *event) |
|
|
|
// Правая кнопка
|
|
|
|
// Правая кнопка
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::keyPressEvent(QKeyEvent *event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EventKeyPressed = true; |
|
|
|
|
|
|
|
IDPressedKey = event->key(); |
|
|
|
|
|
|
|
if (IDPressedKey == Qt::Key_Escape) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Нажатие Esc
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|