Hiding mouse cursor, qt quick
-
Re: Hiding mouse cursor in QML
Tried both solutions given in this thread separately but they don't seem to do anything to the display, a pointer always shows up at the top left of the display. Other solutions attempted are creating a mouse area under the window and blanking that cursor, but I don't even have a mouse plugged in and will strictly use a touch screen.
Here is my main.qml:
import QtQuick import QtQuick.Window 2.15 import QtQuick.Controls 2.0 import io.qt.backend 1.0 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") HoverHandler { id: mouse cursorShape: Qt.BlankCursor } }
and main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) { qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif } QGuiApplication app(argc, argv); QGuiApplication::setOverrideCursor; QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
for this second solution I get warning: statement has no effect [-Wunused-value]
using qt 6.5, ubuntu,
-
Re: Hiding mouse cursor in QML
Tried both solutions given in this thread separately but they don't seem to do anything to the display, a pointer always shows up at the top left of the display. Other solutions attempted are creating a mouse area under the window and blanking that cursor, but I don't even have a mouse plugged in and will strictly use a touch screen.
Here is my main.qml:
import QtQuick import QtQuick.Window 2.15 import QtQuick.Controls 2.0 import io.qt.backend 1.0 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") HoverHandler { id: mouse cursorShape: Qt.BlankCursor } }
and main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) { qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif } QGuiApplication app(argc, argv); QGuiApplication::setOverrideCursor; QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
for this second solution I get warning: statement has no effect [-Wunused-value]
using qt 6.5, ubuntu,
@hazbody21 QGuiApplication::setOverrideCursor is a function.
-
@hazbody21 QGuiApplication::setOverrideCursor is a function.
-