转《Qt教程一 —— 第四章:使用窗口部件》
2016-01-28 18:03
381 查看
本次内容均转自 http://www.cppblog.com/lai3d/archive/2007/07/21/28477.html
/****************************************************************
**
** Qt教程一 - 4
**
****************************************************************/
#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
class MyWidget : public QWidget
{
public:
MyWidget( QWidget *parent=0, Qt::WindowFlags f = 0 );
};
MyWidget::MyWidget( QWidget *parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setMinimumSize( 200, 120 );
setMaximumSize( 200, 120 );
QPushButton *quit = new QPushButton( "Quit", this );
quit->setGeometry( 62, 40, 75, 30 );
quit->setFont( QFont( "Times", 18, QFont::Bold ) );
connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
}
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyWidget w;
w.setGeometry( 100, 100, 200, 120 );
w.show();
return a.exec();
}
/****************************************************************
**
** Qt教程一 - 4
**
****************************************************************/
#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
class MyWidget : public QWidget
{
public:
MyWidget( QWidget *parent=0, Qt::WindowFlags f = 0 );
};
MyWidget::MyWidget( QWidget *parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setMinimumSize( 200, 120 );
setMaximumSize( 200, 120 );
QPushButton *quit = new QPushButton( "Quit", this );
quit->setGeometry( 62, 40, 75, 30 );
quit->setFont( QFont( "Times", 18, QFont::Bold ) );
connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
}
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyWidget w;
w.setGeometry( 100, 100, 200, 120 );
w.show();
return a.exec();
}
相关文章推荐
- 转《Qt教程一 —— 第三章:家庭价值》
- 最新的QT git代码到code.qt.io/cgit,还有planet.qt.io有许多博客
- 【QTP】自动化测试:
- QT5+OpenCV团块运动检测
- Qt5.5连接mysql数据库提示QMYSQL driver not loaded
- QT Creator 如何将第三方库加入到环境内
- QT5+OpenCV人脸识别
- QT5+OpenCV人脸、人眼检测
- 编译VTK时Qt5_DIR-NOTFOUND的解决方法
- QT 主要类使用方法
- 详细介绍QT 主要类使用方法
- deploy 自己编写的 QT 程序 (window下打包程序)
- qt5.3的操作技巧
- QTextEdit实现语法高亮-Syntax Highlighter Example例子简单介绍
- 自学QT之建立子项目
- 自学QT之实现程序启动画面
- QT5+OpenCV环境搭建及入门相关
- qt 静态成员函数
- QT backgound-image 与 bord-image
- qt 的一个bug