📄 03-01.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -