#pragma once #include #include #include #include #include #include namespace ZShell::internal { class Cursor : public QObject { Q_OBJECT QML_SINGLETON QML_ELEMENT public: Q_INVOKABLE void setOverride(Qt::CursorShape shape) { if (m_shape == shape) return; if (m_shape) QGuiApplication::changeOverrideCursor(QCursor(shape)); else { QGuiApplication::setOverrideCursor(QCursor(shape)); } m_shape = shape; } Q_INVOKABLE void clearOverride() { if (!m_shape) return; QGuiApplication::restoreOverrideCursor(); m_shape.reset(); } private: std::optional m_shape; }; } // namespace ZShell::internal