Delay. Максимальное время для событий равно ожиданию

main
Artem Proskurnev 3 years ago
parent 30cd4c00be
commit 3928caef5d
  1. 5
      main.cpp
  2. 6
      qtsgraph.cpp

@ -22,6 +22,11 @@ void QTSGraph::PaintBox()
// Начало рисования
//ShowAxes();
Circle(100, 100, 20);
Delay(1000);
Circle(200, 200, 20);
Delay(10);
Circle(300, 300, 20);
SetColor(clGreen);
Line(0, 0, 600, 600);
SetColor(0xFF0000);

@ -42,7 +42,7 @@ void QTSGraph::Delay(int ms)
{
QTime dieTime= QTime::currentTime().addMSecs(ms);
while (QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
QCoreApplication::processEvents(QEventLoop::AllEvents, ms);
}
void QTSGraph::Ellipse(int x1, int y1, int x2, int y2)
@ -191,7 +191,7 @@ TPixel QTSGraph::ReadMousePosition()
TPixel t;
t.x = MouseMovePosition.x();
t.y = MouseMovePosition.y();
t.color = Canvas.toImage().pixelColor(t.x, t.y).rgba() % 0x1000000;
t.color = GetPixel(t.x, t.y);
if(SwapYAxis) t.y = Canvas.height() - t.y - 1;
if(MoveOtoCenter)
{
@ -206,7 +206,7 @@ TPixel QTSGraph::GetLastMouseClickPosition()
TPixel t;
t.x = LastMouseClickPosition.x();
t.y = LastMouseClickPosition.y();
t.color = Canvas.toImage().pixelColor(t.x, t.y).rgba() % 0x1000000;
t.color = GetPixel(t.x, t.y);
if(SwapYAxis) t.y = Canvas.height() - t.y - 1;
if(MoveOtoCenter)
{

Loading…
Cancel
Save