feat: progress on changing interactions to mousearea again

This commit is contained in:
2026-09-30 14:26:59 +02:00
parent f6fa2f0230
commit be3c938c39
5 changed files with 212 additions and 220 deletions
+9 -5
View File
@@ -2,6 +2,8 @@
#include <qcursor.h>
#include <qguiapplication.h>
#include <qlogging.h>
#include <qnamespace.h>
#include <qobject.h>
#include <qqmlintegration.h>
@@ -14,23 +16,25 @@ class Cursor : public QObject {
public:
Q_INVOKABLE void setOverride(Qt::CursorShape shape) {
if (m_override)
if (m_shape == shape) return;
if (m_shape)
QGuiApplication::changeOverrideCursor(QCursor(shape));
else {
QGuiApplication::setOverrideCursor(QCursor(shape));
m_override = true;
}
m_shape = shape;
}
Q_INVOKABLE void clearOverride() {
if (!m_override) return;
if (!m_shape) return;
QGuiApplication::restoreOverrideCursor();
m_override = false;
m_shape.reset();
}
private:
bool m_override = false;
std::optional<Qt::CursorShape> m_shape;
};
} // namespace ZShell::internal