Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3558828
  • 博文数量: 1575
  • 博客积分: 19423
  • 博客等级: 上将
  • 技术积分: 16102
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-19 21:36
个人简介

专注专心

文章分类

全部博文(1575)

文章存档

2020年(10)

2018年(7)

2016年(6)

2015年(21)

2014年(32)

2013年(279)

2012年(516)

2011年(309)

2010年(260)

2009年(92)

2008年(15)

2007年(28)

我的朋友

分类: IT职场

2011-10-14 11:01:12

Operating system

Platform


Desktop

Symbian

Maemo


Windows

Yes

Yes

Yes

Linux

Yes

No

Yes


Mac OS X

Yes

No

No


http://blog.sina.com.cn/tanghao0730

qmake设置环境变量 Appendix A


p28

小窗口hello

1 #include

//qt类定义头文

2 #include

//qt标签头文件

3 int main(int argc, char *argv[])


4 {


5 QApplication app(argc, argv);

//对象

6 QLabel *label = new QLabel("Hello Qt!");

//label插件对象

7 label->show();

//显示标签

8 return app.exec();

//控制动作

9 }


linux

need the program's


code in a file called hello.cpp in a directory called hello.


qmake -project .pro文件

qmake *.pro 产生Makefile

make 编译 ./hello 运行


Windows MinGW

compiler

Visual C++

QLabel *label = new QLabel("

Hello "


"Qt!

")

//html格式文字编辑


p32 Making Connections

响应用户动作 事件


1 #include


2 #include

//按钮头文件

3 int main(int argc, char *argv[])

//固定格式参数

4 {


5 QApplication app(argc, argv);


6 QPushButton *button = new QpushButton("Quit");

//创建按钮对象

7 QObject::connect(button, SIGNAL(clicked()),

//::? 发出信号,

8 &app, SLOT(quit()));

//& 接收信号(动作)

9 button->show();

//显示按钮

10 return app.exec();


11 }



Laying Out Widgets

插件位置安排

1 #include


2 #include


3 #include


4 #include


5 int main(int argc, char *argv[])


6 {


7 QApplication app(argc, argv);


8 QWidget *window = new QWidget;

//主窗口

9 window->setWindowTitle("Enter Your Age");

//注标题

10 QSpinBox *spinBox = new QspinBox;

//

11 QSlider *slider = new Qslider(Qt::Horizontal);

//水平排列

12 spinBox->setRange(0, 130);

//插件活动范围

13 slider->setRange(0, 130);

 

14 QObject::connect(spinBox, SIGNAL(valueChanged(int)),


15 slider, SLOT(setValue(int)));


16 QObject::connect(slider, SIGNAL(valueChanged(int)),

//14-7同时执行事件

17 spinBox, SLOT(setValue(int)));


18 spinBox->setValue(35);

//设初值自变量

19 QHBoxLayout *layout = new QHBoxLayout;

//格子式编排

20 layout->addWidget(spinBox);

//添加b ox

21 layout->addWidget(slider);

//添加进度栏

22 window->setLayout(layout);

 

23 window->show();

//显示主窗口

24 return app.exec();

//固定返回

25 }



QHBoxLayout QQVBoxLayout GridLayout

自动分配组件所需大小


Using the Reference Documentation

Qt Assistant, linux assistant


2. Creating Dialogs

阅读(947) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~