Files
z-bar-qt/Plugins/ZShell/Internal/cursor.hpp
T
zach dc77ea44a4
C++ / fmt (pull_request) Successful in 5s
C++ / clang-tidy (pull_request) Failing after 9s
C++ / build (pull_request) Failing after 19s
JS/TS / fmt (pull_request) Successful in 9s
JS/TS / lint (pull_request) Successful in 7s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 52s
Python / verify (pull_request) Successful in 1m33s
Rust / fmt (pull_request) Successful in 43s
Rust / clippy (pull_request) Successful in 57s
feat: progress on changing interactions to mousearea again
2026-09-29 00:02:14 +02:00

41 lines
738 B
C++

#pragma once
#include <qcursor.h>
#include <qguiapplication.h>
#include <qlogging.h>
#include <qnamespace.h>
#include <qobject.h>
#include <qqmlintegration.h>
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<Qt::CursorShape> m_shape;
};
} // namespace ZShell::internal