在Qt4.4的技术预览版上, 已集成了 WebKit的支持, 很容易嵌入到Qt应用程序中.
编译Qt4.4-tp1 for arm
我这里使用的是mx27的bsp, jpeg, png都使用系统库. 尚未对Qt进行削减.
#!/bin/sh
./configure \
-prefix /opt/QtCore-4.4-tp1-arm/ \
-release -shared \
-fast \
-pch \
-no-qt3support \
-qt-sql-sqlite \
-no-libtiff -no-libmng \
-system-libjpeg \
-system-zlib \
-system-libpng \
-qt-freetype \
-no-openssl \
-nomake examples -nomake demos -nomake tools\
-optimized-qmake \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm\
-no-xinerama -no-xshape \
-no-separate-debug-info \
-xplatform qws/linux-arm-g++ \
-embedded arm \
-depths 16 \
-no-qvfb \
-qt-gfx-linuxfb \
-no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb\
-qt-kbd-vr41xx \
-I /opt/freescale/ltib/rootfs/usr/include \
-L /opt/freescale/ltib/rootfs/usr/lib \
-confirm-license
编写一个使用QWebView的应用程序, 这里我使用的是WebKit自带的QtLauncher示例, 这个示例代码简洁易懂.只要修改一下QtLauncher.pro, 使用qmake 重新生成Makefile即可. 代码就不贴上来了
/opt/QtCore-4.4-tp1-arm/bin/qmake -spec /opt/QtCore-4.4-tp1-arm/mkspecs/qws/linux-arm-g++ -o Makefile QtLauncher.pro
make
Note:
注意一点的是, 基于QVFB, Framebuffer的Qt使用的是默认字体, 所有在显示中文上有些问题. 需要在程序中重新设置中文字体, 不然browser打开中文网页就是方块了 . 我使用了微软的雅黑字体.
在main.cpp中添加一句:
app.setFont( QFont( "Microsoft YaHei", 10, QFont::Normal ) );
记得将msyh.tty拷贝到字体目录下 :)
编译Qt4.4-tp1 for arm
我这里使用的是mx27的bsp, jpeg, png都使用系统库. 尚未对Qt进行削减.
#!/bin/sh
./configure \
-prefix /opt/QtCore-4.4-tp1-arm/ \
-release -shared \
-fast \
-pch \
-no-qt3support \
-qt-sql-sqlite \
-no-libtiff -no-libmng \
-system-libjpeg \
-system-zlib \
-system-libpng \
-qt-freetype \
-no-openssl \
-nomake examples -nomake demos -nomake tools\
-optimized-qmake \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm\
-no-xinerama -no-xshape \
-no-separate-debug-info \
-xplatform qws/linux-arm-g++ \
-embedded arm \
-depths 16 \
-no-qvfb \
-qt-gfx-linuxfb \
-no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb\
-qt-kbd-vr41xx \
-I /opt/freescale/ltib/rootfs/usr/include \
-L /opt/freescale/ltib/rootfs/usr/lib \
-confirm-license
编写一个使用QWebView的应用程序, 这里我使用的是WebKit自带的QtLauncher示例, 这个示例代码简洁易懂.只要修改一下QtLauncher.pro, 使用qmake 重新生成Makefile即可. 代码就不贴上来了
/opt/QtCore-4.4-tp1-arm/bin/qmake -spec /opt/QtCore-4.4-tp1-arm/mkspecs/qws/linux-arm-g++ -o Makefile QtLauncher.pro
make
Note:
注意一点的是, 基于QVFB, Framebuffer的Qt使用的是默认字体, 所有在显示中文上有些问题. 需要在程序中重新设置中文字体, 不然browser打开中文网页就是方块了 . 我使用了微软的雅黑字体.
在main.cpp中添加一句:
app.setFont( QFont( "Microsoft YaHei", 10, QFont::Normal ) );
记得将msyh.tty拷贝到字体目录下 :)