|
|
@ -103,6 +103,7 @@ void QTSGraph::Circle(int x, int y, int radius) |
|
|
|
|
|
|
|
|
|
|
|
bool QTSGraph::MouseClicked() |
|
|
|
bool QTSGraph::MouseClicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 50); |
|
|
|
bool m = EventMouseClicked; |
|
|
|
bool m = EventMouseClicked; |
|
|
|
EventMouseClicked = false; |
|
|
|
EventMouseClicked = false; |
|
|
|
return m; |
|
|
|
return m; |
|
|
@ -149,6 +150,18 @@ int QTSGraph::ReadKey() |
|
|
|
return t; |
|
|
|
return t; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int QTSGraph::ReadMouseButton() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(IDMouseButton == -1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
while(!MouseClicked() && this->isVisible()) |
|
|
|
|
|
|
|
Delay(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int t = IDMouseButton; |
|
|
|
|
|
|
|
IDMouseButton = -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); |
|
|
@ -233,10 +246,17 @@ void QTSGraph::mousePressEvent(QMouseEvent *event) |
|
|
|
if (event->buttons() & Qt::LeftButton) |
|
|
|
if (event->buttons() & Qt::LeftButton) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Левая кнопка
|
|
|
|
// Левая кнопка
|
|
|
|
|
|
|
|
IDMouseButton = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (event->buttons() & Qt::RightButton) |
|
|
|
else if (event->buttons() & Qt::RightButton) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Правая кнопка
|
|
|
|
// Правая кнопка
|
|
|
|
|
|
|
|
IDMouseButton = 2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (event->buttons() & Qt::MiddleButton) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Средняя кнопка
|
|
|
|
|
|
|
|
IDMouseButton = 3; |
|
|
|
} |
|
|
|
} |
|
|
|
ResetTimer->start(ResetInterval); |
|
|
|
ResetTimer->start(ResetInterval); |
|
|
|
} |
|
|
|
} |
|
|
|