第12章 嵌入式Linux图形用户界面.ppt

  1. 1、本文档共90页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第12章 嵌入式Linux图形用户界面

12.1.1 嵌入式GUI的特点 嵌入式GUI具备以下特点: 占用的存储空间少; 运行时占用资源少; 运行速度及响应速度快; 可靠性高; 便于移植和定制。 示例程序完整过程 使用Vi编辑器编辑原代码文件; [root@vm-dev hello]# vi hello.cpp 使用qmake命令进行编译hello.cpp工程文件; [root@vm-dev hello]# /usr/local/Trolltech /qt-4.4.3/bin/qmake –project 使用qmake命令编译生成Makefile文件 [root@vm-dev hello]# /usr/local/ Trolltech /qt-4.4.3/bin/qmake 使用make命令编译生成执行文件 [root@vm-dev hello]#make 运行执行文件 [root@vm-dev hello]# ./hello 空间几何排列程序示例 实例演示在一个窗口中排列多个控件,并利用信号和槽的方法使控件同步。 程序中使用了三个控件:QSpinBox,QSlider 和QWidget。 QWidget是这个程序的主窗口。 QSpinBox和QSlider被放在QWidget中;他们是QWidget的子窗体,QWidget没有父窗体,它是程序的顶层窗口。 程序要求用户通过spin box或者slider输入年龄。 finddialog.cpp源文件代码示例 【清单12.4】 //finddialog.cpp /* 文件头和构造函数部分 */ #include QtGui #include finddialog.h FindDialog::FindDialog(QWidget *parent) : QDialog(parent) { label = new QLabel(tr(Find what:)); lineEdit = new QLineEdit; label-setBuddy(lineEdit); caseCheckBox = new QCheckBox(tr(Match case)); backwardCheckBox = new QCheckBox(tr(Search backward)); findButton = new QPushButton(tr(Find)); findButton-setDefault(true); findButton-setEnabled(false); closeButton = new QPushButton(tr(Close)); connect(lineEdit, SIGNAL(textChanged(const QString )), this, SLOT(enableFindButton(const QString ))); connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked())); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *topLeftLayout = new QHBoxLayout; topLeftLayout-addWidget(label); topLeftLayout-addWidget(lineEdit); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout-addLayout(topLeftLayout); leftLayout-addWidget(caseCheckBox); leftLayout-addWidget(backwardCheckBox); QVBoxLayout *rightLayout = new QVBoxLayout; rightLayout-addWidget(findButton); rightLayout-addWidget(closeButton); rightLayout-addStretch(); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout-addLayout(leftLayout); mainLayout-addLayout(rightLayout); setLayout(mainLayou

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档