测试qt程序

这里使用明远提供的文件系统来测试,QT移植不成功,后面需试试yocto来制作带QT的根文件系统

安装QT5交叉编译工具
sh fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh
按照默认提示,安装到/opt/…目录下面
在这里插入图片描述
source /opt/fsl-imx-fb/3.14.52-1.1.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

cd /my-imx6/05_rootfs/rootfs/qt-test/Qt5_NMap_CarouselDemo_1.0
qmake
make
编译通过后把Qt5_NMap_CarouselDemo_1.0整个目录拷贝到开发板上
./Qt5_NMap_CarouselDemo -platform eglfs
在这里插入图片描述

把qt库拷贝到目录,然后再拷贝到开发板的/usr/lib目录下面,拷贝的时候保持链接属性,
暂未验证这步是否必须
cp -rf -d /opt/fsl-imx-fb/3.14.52-1.1.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/* /my-imx6/05_rootfs/rootfs/qt-test/lib

./Qt5_NMap_CarouselDemo –platform eglfs
QT程序在板子运行起来了

下面来测试一下QT自带的仪表盘程序试试
cp –rf /opt/Qt5.5.0/Examples/Qt-5.5/quick/extras/dashboard /my-imx6/05_rootfs/rootfs/qt-test
cd /my-imx6/05_rootfs/rootfs/qt-test/dashboard
qmake
make

编译通过,拷贝到板子上面
./dashboard -platform eglfs
运行起来了

测试QT程序的时候,还碰到一个问题

对应的源代码是这样的

QQuickView view;
view.setSource(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QLatin1String("/Qt5_NMap_CarouselDemo.qml")));

改成下面这样
view.setSource(QUrl(“qrc:/main.qml”));
就能解决

猜你喜欢

转载自blog.csdn.net/qq_41903811/article/details/84591193