Qt World Summit: Register Today!

[SOLVED] Hide cursor on Raspberry Pi in Qt Quick Application

  • Hello,

    I have a problem with my application. I created default project with QtCreator: Qt Quick Application and I choosed QtQuick 2.0

    @#include <QtGui/QGuiApplication>
    #include "qtquick2applicationviewer.h"

    int main(int argc, char *argv[])
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    return app.exec(&#41;;


    I compiled this one on my Raspberry Pi. I started program with command:
    @./untitled -platform eglfs @

    and I had warnings:
    @EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
    EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).@
    So I set environmental variables:

    As I wrote in title I wanted to disable cursor also so I added:

    I started program again. I had same warnings and cursor. So I ran only my qml file:
    @qmlscene qml/untitled/main.qml -platform eglfs @

    This one works great. What I have to do to run my C++ program without cursor and warnings?

    I also tried add at line 7 this one:

    It works on my desktop Linux, but not on Raspberry.

    edit: I'm not sure that I choosed good category. Maybe I should write in Mobile and Embedded. Sorry for that.

  • Hi!

    Here is how I run a QT5 program on my raspberryPi without any mouse cursor :

    ./test1 -nomouse -platform eglfs

    I did not add any special lines in my code to remove the cursor. I think that the most important thing to do is to export the variable QT_QPA_EGLFS_HIDECURSOR.

    About the EGLFS warning, I'll have to check, but I think that I also get these, without any issue for my program.

  • I've just checked, I also get the EGLFS warning, but as I said, they do not have impact on the execution of my program.

  • Thanks for your replay. I found solution few minutes ago. The problem was I had to run my program with root permissions so I used sudo. I thought I tested it without sudo but I was wrong. In sudo's manual I found it:
    The ‑E (preserve environment) option indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the ‑E option is specified and the user does not have permission to preserve the environment.@
    Now my programs sees environmental variables.

    JF002: You don't need to use parameter: -nomouse, it works without it :)

    Thanks for your help!

Log in to reply