Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void QtQuick2ApplicationViewer::mouseClick(QVariant x1, QVariant y1)
- {
- float x = x1.toFloat();
- float y = y1.toFloat();
- qDebug() << "click @ " << x << "," << y;
- this->cursor().setPos(x, y);
- QMouseEvent pressEvent(QEvent::MouseButtonPress, QPointF(x, y),
- Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPointF(x, y),
- Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- qDebug() << pressEvent.globalPos().x() << "; " << pressEvent.globalPos().y();
- qDebug() << pressEvent.windowPos().x() << "; " << pressEvent.windowPos().y();
- qDebug() << pressEvent.screenPos().x() << "; " << pressEvent.screenPos().y();
- qDebug() << pressEvent.localPos().x() << "; " << pressEvent.localPos().y();
- QGuiApplication::sendEvent(this, &pressEvent);
- QGuiApplication::sendEvent(this, &releaseEvent);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement