Raspberry Pi Qt5设置物理屏幕尺寸 [英] Raspberry Pi Qt5 Set physical screen size

查看:3381
本文介绍了Raspberry Pi Qt5设置物理屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我运行它时,我会看到一个黑色的屏幕,试图显示一个弹出窗口这是一个QFrame。



我认为它不能定位,因为我有错误消息到达开始:



<不要查询物理屏幕大小,默认为100 dpi。



EGLFS:要覆盖,请设置QT_QPA_EGLFS_PHYSICAL_WIDTH和QT_QPA_EGLFS_PHYSICAL_HEIGHT(以毫米为单位) )



EGLFS:无法查询屏幕深度,默认为32。



EGLFS:要覆盖,设置QT_QPA_EGLFS_DEPTH。


当我禁用QFrame时,默认情况下,全屏启动应用程序,而我没有设置。



我试图设置这些环境变量:

  int main (int argc,char * argv [])
{
QByteArray width = qgetenv(Q T_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();
}

但是错误信息仍然显示。



主窗口是一个QWidget,我使用以下命令定义了他的大小:

  setFixedSize(1280,720) ; 

我的问题是如何正确设置这些变量,还是有其他解决方案?

解决方案

我只是把这样的东西放在

 导出QT_QPA_EGLFS_PHYSICAL_WIDTH = myWidth 
QT_QPA_EGLFS_PHYSICAL_HEIGHT = myHeight
QT_QPA_EGLFS_DEPTH = myDepth

bashrc来摆脱这些错误。物理宽度和高度也不是像素,屏幕深度是显示器的颜色深度(在我的情况下为18)。


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 ?

解决方案

I just put something like

export QT_QPA_EGLFS_PHYSICAL_WIDTH=myWidth 
       QT_QPA_EGLFS_PHYSICAL_HEIGHT=myHeight   
       QT_QPA_EGLFS_DEPTH=myDepth

in my .bashrc to get rid of those errors. Also the physical width and height are in millimeters not pixels, and screen depth is color depth of your display (18 in my case).

这篇关于Raspberry Pi Qt5设置物理屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆