专注专心
分类: 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
3 int main(int argc, char *argv[])
5 QApplication app(argc, argv);
6 QLabel *label = new QLabel("Hello Qt!");
code in a file called hello.cpp in a directory called 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