Issue
I have developed a simple QML application and I run with cross-compiling on the target device (RPI with a touchscreen).
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
// Not helping
MouseArea {
anchors.fill: parent;
hoverEnabled: true
}
Button {
text: "quit";
onClicked: Qt.quit()
anchors.centerIn: parent;
width: 300
height: 250
}
}
The problem that is confused me is that when I touch anywhere in the application, the underlying desktop (RPI desktop) is also touched. It means that all mouse or touch events are forwarded to the back screen which is Raspbian Desktop.
This is my sample code. (it’s not the code issue. I think it should be related to EGLFS or something else in the os)
Any hints will be appreciated.
UPDATE:
I found that the problem occurred only if I run the app with "-platform eglfs" arguments.
UPDATE 2:
I tested with RPI4 and it seems the problem only existed with RPI3
Solution
The eglfs platform is for running without a window system. If you are on the Raspbian desktop, isn’t an X server running? so you should let Qt choose the appropriate plugin for the window system (xcb or wayland). You can still force the application fullscreen using QWindow::setVisibility(). Or if you want to deploy an embedded fullscreen app and run on the virtual console with eglfs, kill the window system. It will be lighter that way.
Answered By – ecloud
Answer Checked By – Dawn Plyler (BugsFixing Volunteer)