03-01.cpp
来自「qt实例代码!《24小时学通qt编程》 的代码!不错!已经在qt2.3.7调试o」· C++ 代码 · 共 39 行
CPP
39 行
#include <qapplication.h>
#include <qwidget.h>
//in the class declaration, wo only need
//to include a new constructor. The other
//methods are inherited from Qwidget:
class MyMainwindow : public QWidget
{
public:
MyMainwindow();
};
MyMainwindow::MyMainwindow()
{
//set the maximum and minimum size
//of the window (widget). wo don't
//need to use the this .point,
//because c++ defaults to the current
//class anyway:
setMinimumSize(200, 100);
setMaximumSize(200, 100);
}
int main(int argc, char **argv)
{
//create the required QApplication
//object. pass on the command line
//argument to the QApplication object
QApplication a(argc,argv);
//Create a MyMainWindow object, and then
//set it as the main widget:
MyMainwindow w;
a.setMainWidget(&w);
//Paint the MyMainWindow object and all
//its child widgets to the screen
w.show();
//
a.exec();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?