|
|
@ -1,7 +1,7 @@ |
|
|
|
#include "qtsgraph.h" |
|
|
|
#include "qtsgraph.h" |
|
|
|
#include "ui_qtsgraph.h" |
|
|
|
#include "ui_qtsgraph.h" |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::delay(int ms) |
|
|
|
void QTSGraph::Delay(int ms) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QTime dieTime= QTime::currentTime().addMSecs(ms); |
|
|
|
QTime dieTime= QTime::currentTime().addMSecs(ms); |
|
|
|
while (QTime::currentTime() < dieTime) |
|
|
|
while (QTime::currentTime() < dieTime) |
|
|
@ -25,9 +25,9 @@ QTSGraph::QTSGraph(int w, int h, int x, int y, QWidget *parent) |
|
|
|
this->setWindowTitle("Рисунок"); |
|
|
|
this->setWindowTitle("Рисунок"); |
|
|
|
m_Pixmap = QPixmap(w, h); |
|
|
|
m_Pixmap = QPixmap(w, h); |
|
|
|
m_Pixmap.fill(Qt::white); |
|
|
|
m_Pixmap.fill(Qt::white); |
|
|
|
starttimer = new QTimer(); |
|
|
|
StartTimer = new QTimer(); |
|
|
|
connect(starttimer, SIGNAL(timeout()), this, SLOT(slotstarttimer())); |
|
|
|
connect(StartTimer, SIGNAL(timeout()), this, SLOT(slotStartTimer())); |
|
|
|
starttimer->start(500); |
|
|
|
StartTimer->start(500); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QTSGraph::~QTSGraph() |
|
|
|
QTSGraph::~QTSGraph() |
|
|
@ -35,7 +35,14 @@ QTSGraph::~QTSGraph() |
|
|
|
delete ui; |
|
|
|
delete ui; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::putpixel(int x, int y, Qt::GlobalColor c) |
|
|
|
bool QTSGraph::MouseClicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bool m = EventMouseClicked; |
|
|
|
|
|
|
|
EventMouseClicked = false; |
|
|
|
|
|
|
|
return m; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::PutPixel(int x, int y, Qt::GlobalColor c) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPainter painter(&m_Pixmap); |
|
|
|
QPainter painter(&m_Pixmap); |
|
|
|
painter.setPen(QPen(QBrush(QColor(c)), 5 )); |
|
|
|
painter.setPen(QPen(QBrush(QColor(c)), 5 )); |
|
|
@ -51,6 +58,7 @@ void QTSGraph::paintEvent(QPaintEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void QTSGraph::mousePressEvent(QMouseEvent *event) |
|
|
|
void QTSGraph::mousePressEvent(QMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
EventMouseClicked = true; |
|
|
|
if (event->buttons() & Qt::LeftButton) |
|
|
|
if (event->buttons() & Qt::LeftButton) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Левая кнопка
|
|
|
|
// Левая кнопка
|
|
|
|