⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 03-03.cpp

📁 qt实例代码!《24小时学通qt编程》 的代码!不错!已经在qt2.3.7调试ok!第3章
💻 CPP
字号:
#include <qapplication.h>
#include <qwidget.h>
//we include qpushbutton.h to be able to
//use the QPushbotton.h
#include <qpushbutton.h>
//wo also include qfont.h to able to
//format the button lable:
#include <qfont.h>

class MyMainwindow : public QWidget
{
public:
	MyMainwindow();
private:
	//locate memory for the button:
	QPushButton *b1;
};

MyMainwindow::MyMainwindow()
{
	setGeometry(100, 100, 200, 120);

	//
	//
	//
	//
	//
	b1 = new QPushButton("Buttom 1", this);
	//
	//
	//
	b1->setGeometry(20, 20, 160, 80);
	//
	b1->setFont(QFont("Time", 18, 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 + -