📄 06-01.cpp
字号:
#include <qapplication.h>
#include <qwidget.h>
#include <qpushbutton.h>
class MyMainwindow : public QWidget
{
public:
MyMainwindow();
private:
QPushButton *b1;
};
MyMainwindow::MyMainwindow()
{
setGeometry(100, 100, 200, 100);
b1 = new QPushButton("This is a push button1", this);
b1->setGeometry(10, 10, 180, 80);
b1->setFont(QFont("Times", 16, QFont::Bold));
}
int main(int argc, char **argv)
{
QApplication a(argc,argv);
MyMainwindow w;
a.setMainWidget(&w);
w.show();
a.exec();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -