且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

不使用X11显示窗体的方法

更新时间:2022-03-16 11:15:34

 
Qt有多个版本,其中QtEmbedded版本自身包含了Gui,可以不使用X11来显示图形窗口界面。
 
QtEmbedded在Redhat下编译步骤:
./configure -embedded
make
make install
 
embedded QT是基于framebuffer实现图形的。所以要想办法把framebuffer打开。
#vi /boot/grub/menu.lst 
在kernel那行最后,加上vga=0x314,这样就把/dev/fd0打开了。否则不能运行QT
重起机器,执行命令#designer -qws 看能把设计器启起来吗? 能起来,说明QT安装OK!
执行自己的程序一样在后面加上 -qws 参数
 
目前,还不能显示中文,自己写的QT程序,中文显示不出来。这们解决:
#cp simhei.ttf /usr/loal/Trolltech/QtEmbedded-4.4.3/lib/fonts/
把你想要的字体复制到这个目录下,QT就能显示中文了
 
 
编译遇到的问题及解决方法
qtiffhandler.cpp: In member function `virtual bool
  QTiffHandler::read(QImage*)':
qtiffhandler.cpp:148: `TIFFReadRGBAImageOriented' undeclared (first use this
  function)
qtiffhandler.cpp:148: (Each undeclared identifier is reported only once for
  each function it appears in.)
gmake[3]: *** [.obj/release-shared/qtiffhandler.o] Error 1
gmake[3]: Leaving directory `/usr/local/qt-x11-opensource-src-4.4.3/src/plugins/imageformats/tiff'
gmake[2]: *** [sub-tiff-make_default] Error 2
gmake[2]: Leaving directory `/usr/local/qt-x11-opensource-src-4.4.3/src/plugins/imageformats'
gmake[1]: *** [sub-imageformats-make_default] Error 2
gmake[1]: Leaving directory `/usr/local/qt-x11-opensource-src-4.4.3/src/plugins'
gmake: *** [sub-plugins-make_default-ordered] Error 2
[root@localhost qt-x11-opensource-src-4.4.3]#
解决
打开 qtiffhandler.cpp 把 TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(tiffImage.bits()), ORIENTATION_TOPLEFT, 0))改为 
TIFFReadRGBAImage(tiff, width, height, reinterpret_cast<uint32 *>(tiffImage.bits()), 0)就好了 你的redhat里的 usr/include/tiffio.h没有前一个函数
 
 
我将环境变量加入到了/root/.bash_profile,自行加入即可