Advertisement
Guest User

Untitled

a guest
Nov 15th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. void QtQuick2ApplicationViewer::mouseClick(QVariant x1, QVariant y1)
  2. {
  3.     float x = x1.toFloat();
  4.     float y = y1.toFloat();
  5.     qDebug() << "click @ " << x << "," << y;
  6.     this->cursor().setPos(x, y);
  7.  
  8.     QMouseEvent pressEvent(QEvent::MouseButtonPress, QPointF(x, y),
  9.                            Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
  10.     QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPointF(x, y),
  11.                            Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
  12.     QGuiApplication::sendEvent(this, &pressEvent);
  13.     QGuiApplication::sendEvent(this, &releaseEvent);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement