# QT
The current compiled and tested version is 5.15.3
## tslib移植
You can skip this step if using openwrt to compile it, but you need to use the tslib path under openwrt when compiling QT.
```
sudo apt-get install autoconf automake libtool autogen pkg-config
wget https://github.com/libts/tslib/releases/download/1.22/tslib-1.22.tar.xz
tar xvf tslib-1.22.tar.xz
cd tslib-1.22
./autogen.sh
./configure --prefix=/home/u64/tslib-1.22/install --host=arm-linux-gnueabihf #Note to change the directory
make
make install
```
## QT porting
Download link to QT 5.15.3: https://pan.baidu.com/s/1gE9xjEmZGV5HymfT57PISg Password: 2p6i
### nossl
```
# Modify the directory of tslib in build.sh
build.sh # Compile QT
```
### openwrt+ssl
```
# Modify the directory of tslib and openwrt staging in build.sh
build_openwrt.sh # Compile QT
```
## Example project
There are some example projects in qt5, which are located in the qtbase/examples directory. We can use the demo of example/widgets/widgets/movie to verify whether qt works normally.
Edit qtbase/examples/widgets/widgets/movie/movie.pro, and make the following changes:
### Compile
```
qmake
make ARCH=arm
```
### Verify
1. Create a QT configuration file, /opt/qt_env.sh
```
export TSLIB_PLUGINDIR=/opt/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONFFILE=/opt/etc/ts.conf
export TSLIB_TSDEVICE=/dev/input/event0
export QT_QPA_PLATFORM=linuxfb
export QT_QPA_FONTDIR=/etc/font
```
2. Copy the files in the lib, bin and etc directories compiled by tslib to the /opt directory
```
# Host PC
cd tslib-1.22/install/
tar cvf tslib.tar bin etc lib
# Target
cd /opt
tftp -g 192.168.1.100 -r tslib.tar
tar xvf tslib.tar
```
3. Rename the font file to fzcircle.ttf and copy it to the /etc/font directory
4. Enable QT environment variables
5. Copy movie and animation.gif in the tbase/examples/widgets/widgets/movie directory to the /opt directory
```
cd /opt
source ./qt_env.sh
chmod +x movie
ssd20x-lcd-init & # Init LCD
movie # run
```