qt版本:qt-everywhere-src-5.12.9
给出QT移植的方法,以及解决QT-rgb24显示的问题。不更改Linux驱动下,让QT正常显示。(我已经以补丁的形式反馈给了官方)
要点:
- 更改qmake
- configure配置
- 可能会遇到arm端的fb为24bit时显示rgb通道不对应的情况(显示为bgr),网上没啥解决办法苦读源码解决的。
移植流程可以参考正点原子的教程(我这里只给出重点需要更改的部分),具体文件:
qt移植相关资料,以及解决rgb24bit显示问题-Linux文档类资源-CSDN下载
1、qmake
#
# qmake configuration for building with aarch64-linux-gnu-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv8-a -lts
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv8-a -lts
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = aarch64-linux-gnu-gcc
QMAKE_CXX = aarch64-linux-gnu-g++
QMAKE_LINK = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++
# modifications to linux.conf
QMAKE_AR = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
QMAKE_NM = aarch64-linux-gnu-nm -P
QMAKE_STRIP = aarch64-linux-gnu-strip
load(qt_config)
2、configure(auto.sh)
#!/bin/bash
./configure -prefix /data/horizon_x3/codes/QT5 \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-extprefix /opt/QT5 \
-xplatform linux-aarch64-gnu-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/data/horizon_x3/codes/tslib-1.22/install_dir/include \
-L/data/horizon_x3/codes/tslib-1.22/install_dir/lib \
-recheck-all
exit
以上一般都能在arm(嵌入式端)正常显示了。自己写个demo测测,可能会有rgb通道显示的问题:
解决办法:找到qt-everywhere-src-5.12.9\qtbase\src\plugins\platforms\linuxfb下的文件
在QT进行绘制时可以mScreenImage.rgbSwapped()可以转变通道对应关系。代码有点多就不贴了。