Search code examples
qtqmlqt-quick

QML: Custom cursor


Is there any way to have custom cursor in application. I am not meaning when mouse enters some area, but when application is launched. Instead of default cursor there is my cursor image.


Solution

  • No, not from QML. I imagine that if there were a way, it would be exposed through the Qt.application type. You can do it from C++ to achieve the same result though:

    int main(int argc, char** argv)
    {
        QGuiApplication app(argc, argv);
        app.setOverrideCursor(Qt::CrossCursor);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl::fromLocalFile("main.qml"));
    
        return app.exec();
    }