void drawShape::mousePressEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton) { x2 = event->x(); y2 = event->y(); drawRect(x2-1, y2-1, 2, 2); if (ox == -1) { ox = x1 = x2; oy = y1 = y2; } drawLine(x1, y1, x2, y2); showPicture(); x1 = x2; y1 = y2; emit sendPoint(x2, y2); emit finished(false); } else if (event->buttons() & Qt::RightButton) { drawLine(ox, oy, x2, y2); showPicture(); setEnabled(false); emit finished(true); } }
void DataGenerator::run() { while(true) { usleep(1000); int arg = qrand(); int amp = qrand() % 2001 - 1000; double ampF = amp / 2000.0; emit sendPoint(QPointF(100.0 * (ampF + 1.0) * cos(arg), 100.0 * (ampF + 1.0) * sin(arg))); } }
void gotIntersection(const tf::Vector3 &pt) { sendPoint(pt.x(), pt.y(), pt.z()); }