I am developping a qt5 application on my raspberry pi on raspbian using cross compilation.
When I run it, I get a black screen trying display a Pop-up which is a QFrame.
I suppose that it cannot be positioned because I have error messages arriving at the beginning :
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).
EGLFS: Unable to query screen depth, defaulting to 32.
EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
When I disable the QFrame, the application is launched in full-screen by default, whereas I didn't set it.
I tried to set these environment variables with :
int main(int argc, char *argv[])
{
QByteArray width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH");
width.setNum(1920);
QByteArray height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
height.setNum(1080);
QApplication a(argc, argv);
MainWindow w;
w.show();
w.launchGame();
return a.exec();
}
But the error messages are still displayed.
The main window is a QWidget and I defined his size using :
setFixedSize(1280, 720);
My question is, how to set these variables correctly or do you have another solution ?
Raspberry Pi 3 Kernel 4.14.27-v7+
Qt 5.10.1 cross-compiled from Ubuntu 16.04 host
I had to add the following to my .profile on my Rpi
Open .profile
sudo nano ~/.profile
I added these lines at end
# physical display properties
export QT_QPA_EGLFS_PHYSICAL_WIDTH=520
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=326
Then reload bash profile with (or reboot)
source .profile
The following link has descriptions for all the EGLFS environment variables:
http://doc.qt.io/qt-5/embedded-linux.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With