5#include <ApplicationServices/ApplicationServices.h>
8#include <QGuiApplication>
11#include <QGraphicsSceneMouseEvent>
16#include <score_lib_base_export.h>
19inline void setCursorPos(QPointF pos)
noexcept
27 = CGEventCreateMouseEvent(
nullptr, kCGEventMouseMoved, ppos, kCGMouseButtonLeft);
28 CGEventPost(kCGHIDEventTap, e);
31 QCursor::setPos(pos.toPoint());
34inline void moveCursorPos(QPointF pos)
noexcept
50 = CGEventCreateMouseEvent(
nullptr, kCGEventMouseMoved, ppos, kCGMouseButtonLeft);
51 CGEventPost(kCGHIDEventTap, e);
54 QCursor::setPos(pos.toPoint());
58inline QPoint globalPos(QMouseEvent* event)
63 CGEventRef
event = CGEventCreate(
nullptr);
64 loc = CGEventGetLocation(event);
67 return QPoint(loc.x, loc.y);
69 return event->globalPosition().toPoint();
73inline QPointF globalPos(QWidget* viewport, QGraphicsSceneMouseEvent* event)
78 CGEventRef
event = CGEventCreate(
nullptr);
79 loc = CGEventGetLocation(event);
82 return QPointF(loc.x, loc.y);
84 return viewport->mapToGlobal(QPoint{0, 0}) + event->pos();
90void hideCursor(
bool hasCursor);
96inline void hideCursor(
bool hasCursor)
98#if !defined(__EMSCRIPTEN__)
99 if(QGuiApplication::overrideCursor())
100 QGuiApplication::changeOverrideCursor(QCursor(Qt::BlankCursor));
102 QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
105inline void showCursor()
107#if !defined(__EMSCRIPTEN__)
108 QGuiApplication::restoreOverrideCursor();
Base toolkit upon which the software is built.
Definition Application.cpp:90