summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmcursor.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmcursor.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcursor.cpp b/src/plugins/platforms/wasm/qwasmcursor.cpp
index 2b3f37300d..c04fa6441a 100644
--- a/src/plugins/platforms/wasm/qwasmcursor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcursor.cpp
@@ -36,6 +36,8 @@
#include <emscripten/emscripten.h>
#include <emscripten/bind.h>
+using namespace emscripten;
+
void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
{
if (!windowCursor || !window)
@@ -54,8 +56,10 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
htmlCursorName = "auto";
// Set cursor on the canvas
- QString canvasId = QWasmScreen::get(screen)->canvasId();
- emscripten::val canvasStyle = emscripten::val::global(canvasId.toUtf8().constData())["style"];
+ QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8();
+ val document = val::global("document");
+ val canvas = document.call<val>("getElementById", val(canvasId.constData()));
+ val canvasStyle = canvas["style"];
canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData()));
}
@@ -68,6 +72,7 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "default";
break;
case Qt::UpArrowCursor:
+ cursorName = "n-resize";
break;
case Qt::CrossCursor:
cursorName = "crosshair";
@@ -91,7 +96,8 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "nwse-resize";
break;
case Qt::SizeAllCursor:
- break; // no equivalent?
+ cursorName = "move";
+ break;
case Qt::BlankCursor:
cursorName = "none";
break;
@@ -111,18 +117,23 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "help";
break;
case Qt::BusyCursor:
- cursorName = "wait";
+ cursorName = "progress";
break;
case Qt::OpenHandCursor:
- break; // no equivalent?
+ cursorName = "grab";
+ break;
case Qt::ClosedHandCursor:
- break; // no equivalent?
+ cursorName = "grabbing";
+ break;
case Qt::DragCopyCursor:
- break; // no equivalent?
+ cursorName = "copy";
+ break;
case Qt::DragMoveCursor:
- break; // no equivalent?
+ cursorName = "default";
+ break;
case Qt::DragLinkCursor:
- break; // no equivalent?
+ cursorName = "alias";
+ break;
default:
break;
}