QFontDatabase: Cannot find font directory问题解决方案(转)

本文介绍了解决Qtopia应用程序在嵌入式设备上因字体库缺失导致无法正常显示的问题。提供了两种方法,一种是直接复制字体文件到指定路径,另一种是在环境变量中设置字体目录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

编译通过后
在/work/check/check/bin下就会有可执行的二进制check文件。[应用程序bin]


将它拷贝到/opt/FriendlyARM/mini2440/root_nfs/下qtopia目录里,同时将Qtopia Core 

OpenSource 4.3.3的库lib拷贝到/opt/FriendlyARM/mini2440/root_nfs/的qt目录

里。/opt/FriendlyARM/mini2440/root_nfs/是开发板要挂载的目录,然后将pc机上

的/opt/FriendlyARM/mini2440/root_nfs/目录挂载到开发板的/mnt/nfs/目录下,然后在开发板里

输入:


#export QTDIR=/mnt/nfs/qt
#export QTEDIR=$QTDIR
#export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
#cd /mnt/nfs/qtopia
#./check -qws


出现:QFontDatabase: Cannot find font directory /usr/local/Trolltech/QtopiaCore-4.3.3-arm/lib/fonts - is Qt installed correctly?


方法1:那你需要做的就是将/mnt/nfs/qt/lib/fonts里的文件拷贝到开发板/usr/local/Trolltech/QtopiaCore-4.3.3-arm/lib/fonts。

方法2:非常感谢半碗蛋炒饭的方法:

           在开发板上输入:export QT_QWS_FONTDIR=/mnt/nfs/qt/lib/fonts     [我的是:export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/ ]

再次运行#./check -qws

这时,开发板上就会出现,咱们最开始的那幅图片,输入密码试一试,验证一下。

建议用方法2 ,但不彻底,
本质上:在/etc/profile 中添加   export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/
To restore this content, you can run the 'unminimize' command. Last login: Thu Jun 5 05:44:30 2025 from 192.168.3.102 ys@tegra-ubuntu:~$ export QT_QPA_PLATFORM=eglfs ys@tegra-ubuntu:~$ export QT_EGLFS_ALWAYS_SET_MODE=1 ys@tegra-ubuntu:~$ export QT_QPA_EGLFS_INTEGRATION=none ys@tegra-ubuntu:~$ ./untitled Device discovery cannot open device "/dev/input/event0" Device discovery cannot open device "/dev/input/event1" Device discovery cannot open device "/dev/input/event2" Device discovery cannot open device "/dev/input/event3" Device discovery cannot open device "/dev/input/event4" Device discovery cannot open device "/dev/input/event5" Device discovery cannot open device "/dev/input/event6" Device discovery cannot open device "/dev/input/event0" Device discovery cannot open device "/dev/input/event1" Device discovery cannot open device "/dev/input/event2" Device discovery cannot open device "/dev/input/event3" Device discovery cannot open device "/dev/input/event4" Device discovery cannot open device "/dev/input/event5" Device discovery cannot open device "/dev/input/event6" Device discovery cannot open device "/dev/input/event0" Device discovery cannot open device "/dev/input/event1" Device discovery cannot open device "/dev/input/event2" Device discovery cannot open device "/dev/input/event3" Device discovery cannot open device "/dev/input/event4" Device discovery cannot open device "/dev/input/event5" Device discovery cannot open device "/dev/input/event6" QFontDatabase: Cannot find font directory /usr/local/qt-for-arm5.15.15/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. QFontDatabase: Cannot find font directory /usr/local/qt-for-arm5.15.15/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. QFontDatabase: Cannot find font directory /usr/local/qt-for-arm5.15.15/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. QFontDatabase: Cannot find font directory /usr/local/qt-for-arm5.15.15/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. QFontDatabase: Cannot find font directory /usr/local/qt-for-arm5.15.15/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. EGL Error : Could not create the egl surface: error = 0x300b 报错
最新发布
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值