QT4编程指导文档推荐

上传人:粗**** 文档编号:135282065 上传时间:2020-06-14 格式:PDF 页数:14 大小:1.32MB
返回 下载 相关 举报
QT4编程指导文档推荐_第1页
第1页 / 共14页
QT4编程指导文档推荐_第2页
第2页 / 共14页
QT4编程指导文档推荐_第3页
第3页 / 共14页
QT4编程指导文档推荐_第4页
第4页 / 共14页
QT4编程指导文档推荐_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《QT4编程指导文档推荐》由会员分享,可在线阅读,更多相关《QT4编程指导文档推荐(14页珍藏版)》请在金锄头文库上搜索。

1、QT4编程实验指导 硬件 博创经典 2410L PC机 Pentumn500 以上 硬盘 80G以上 软件 PC机操作系统 RHEL4 xshell ARM Linux开发环境 4 4 0 4 4 0编译 QT X11环境 cd home sprife mkdir qt4 cd qt4 mkdir for pc mkdir for arm cp home 4 4 0 home sprife qt4 for pc cp home 4 4 0 home sprife qt4 for arm cp home home sprife qt4 for arm cd home sprife qt4 for

2、 pc tar xzvf 4 4 0 cd qt x11 opensource src 4 4 0 configure configure prefix usr local Trolltech Qt x11 4 4 0 yes gmake gmake install 编译 QT E环境 注 核心板使用PXA270可略去触摸屏步骤使用USB鼠标作为输入 1 编译触摸屏库 cd home sprife qt4 for arm tar xjvf cd vi bin sh export CC arm linux gcc echo ac cv func malloc 0 nonnull yes conf

3、igure host arm linux cache file prefix PWD make make install 编译 2 编译 QT E库 cd home sprife qt4 for arm tar xjvf 4 4 0 cp a lib qt embedded linux opensource src 4 4 0 lib cp a include ts qt embedded linux opensource src 4 4 0 include cd qt embedded linux opensource src 4 4 0 configure embedded arm xpl

4、atform qws linux arm g depths 16 little endian qt mouse linuxtp qt mouse tslib I home sprife qt4 for arm include L home sprife qt4 for arm lib prefix mnt nfs Trolltech qt embedded 4 4 0 make make install prefix 选项要特殊注意 该指定目录必须要与实际NFS目录对应否则字体处 会出现错误 3 测试触摸屏及 QT E程序 1 建立 NFS共享目录 arm2410cl cd mkdir arm

5、2410cl cd arm2410cl mkdir Trolltech cd Trolltech mkdir qt embedded 4 4 0 cd qt embedded 4 4 0 cp home sprife qt4 for arm qt embedded linux opensource src 4 4 0 l ib arf cp home sprife qt4 for arm etc arf cp home sprife qt4 for arm bin arf 2 ARM 端挂载 NFS共享目录 mount o nolock rsize 4096 wsize 4096 mnt nf

6、s 3 设置环境变量 cd mnt nfs Trolltech qt embedded 4 4 0 export QTDIR PWD export LD LIBRARY PATH PWD lib export TSLIB TSDEVICE dev event0 export TSLIB PLUGINDIR PWD lib ts export TSLIB CONSOLEDEVICE none export TSLIB CONFFILE PWD etc export POINTERCAL FILE PWD etc export QWS MOUSE PROTO tslib dev event0 ex

7、port TSLIB CALIBFILE PWD etc export LANG zh CN 4 执行触摸屏校准程序 在 qt embedded 4 4 0 下 bin ts calibrate 如果出现如下错误提示 Couldnt load module pthres No raw modules loaded ts config Success 则更改配置文件选择一个输入设备 vi mnt nfs Trolltech qt embedded 4 4 0 etc Uncomment if you wish to use the linux input layer event interfac

8、e module raw input 更改为 Uncomment if you wish to use the linux input layer event interface module raw input 若提示 dev touchscreen ucb1x00 No such file or directory 则一般是环境变量没设置好的问题 可以重新仔细检查环境变量的设置 再次执行触摸屏校准程序即可 程序会自动存储坐标校准信息以便应用程序 使用 此时如无错误则进入5 点触摸屏校准程序并存储配置文件 还可以进行其他触摸屏测试程序ts test ts print 等 5 执行 QT E带

9、触摸屏的例子程序 在宿主机端拷贝编译好的ARM端可执行程序 cp home sprife qt4 for arm qt embedded linux opensource src 4 4 0 e xamples widgets digitalclock digitalclock arm2410cl Trolltech ARM 端 执 行该程序 digitalclock qws 如出现如下错误 error while loading shared libraries cannot open shared object file No such file or directory 则在宿主机端交叉

10、编译器目录下搜索该库文件 拷贝到lib 目录下 具体库 文件位置可能不尽相同 cp opt host armv4l armv4l unknown linux lib arm2410cl Trolltech qt embedded 4 4 0 lib 若出现错误 error while loading shared libraries libstdc cannot open shared object file No such file or directory 拷贝 cp home bc 3 4 2 arm2410cl Trolltech 若 error while loading share

11、d libraries cannot open shared object file No such file or directory 则 cp home bc 3 4 2 arm2410cl Trolltech 如果想让 QT E在 ARM 端支持 USB鼠标 可以在 ARM端配置环境变量 2410 核心板 export QWS MOUSE PROTO MouseMan dev input mouse0 270 核心板 export QWS MOUSE PROTO TPanel dev touchpanel MouseMan dev mice 即可 编写 QT X11程序 进入 QT fo

12、r X11 目录中进行设计 root vm dev cd home sprife qt4 for pc 建立实验目录 root vm dev for pc mkdir testqt x11 root vm dev for pc cd testqt x11 root vm dev testqt x11 使用 designer 编辑程序控件 root vm dev testqt x11 home sprife qt4 for pc qt x11 opensource src 4 4 0 bin designer 将弹出 designer 界面 选择一个窗口布局Widget 点击 创建 拖拽几个简单

13、的控件 TextEdit PushBotton TextLabel 进行界面设计 初始化控件及相关属性内容 建立信号与槽的连接 show 按钮与文本编辑框的连接clicked clear 第二组信号与槽的连接 exit 按钮与 Form 的连接 clicked closed 退出界面编辑保存为UI 格式 root vm dev testqt x11 home sprife qt4 for pc qt x11 opensource src 4 4 0 bin designer root vm dev testqt x11 ls root vm dev testqt x11 编辑函数 root v

14、m dev testqt x11 vi include int main int argc char argv QApplication app argc argv QWidget widget new QWidget Ui Form ui widget widget show return root vm dev testqt x11 ls root vm dev testqt x11 编译程序生成工程文件 pro root vm dev testqt x11 home sprife qt4 for pc qt x11 opensource src 4 4 0 bin qmake proje

15、ct root vm dev testqt x11 ls 编译生成 Makefile 文件 root vm dev testqt x11 home sprife qt4 for pc qt x11 opensource src 4 4 0 bin qmake root vm dev testqt x11 ls Makefile 编译生成可执行文件 root vm dev testqt x11 make usr local Trolltech Qt x11 4 4 0 bin uic o g c pipe O2 Wall W D REENTRANT DQT NO DEBUG DQT GUI LI

16、B DQT CORE LIB DQT SHARED I usr local Trolltech Qt x11 4 4 0 mkspecs linux g I I usr local Trolltech I usr local Trolltech I usr local Trolltech I usr local Trolltech I usr local Trolltech I I I o g Wl rpath usr local Trolltech Qt x11 4 4 0 lib o testqt x11 L usr local Trolltech lQtGui L usr local Trolltech L usr X11R6 lib lpng lSM lICE pthread pthread lXi lXrender lXrandr lfreetype lfontconfig lXext lX11 lQtCore lz lm pthread lrt ldl lpthread root vm dev testqt x11 ls Makefile testqt x11 root v

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号