📄 main.cpp
字号:
#include <qapplication.h>#include <qlabel.h>#include <qbuttongroup.h>#include <qpushbutton.h>int main( int argc, char **argv){ QApplication app( argc, argv); QButtonGroup box; box.setGeometry(0,20,200,100); // QLabel label("hello,world!",&box); QLabel *label = new QLabel("Hello,world!",0); label->setAlignment(Qt::AlignVCenter |Qt:: AlignHCenter); label->setGeometry(60,20,80,30); label->hide(); QPushButton button1("h&ide",&box); button1.setGeometry(80,60,40,30); QPushButton button0("&show",&box); button0.setGeometry(20,60,40,30); QPushButton button2("e&xit",&box); button2.setGeometry(140,60,40,30); app.connect(&button0,SIGNAL(pressed()),label,SLOT(show())); app.connect(&button1,SIGNAL(clicked()),label,SLOT(hide())); app.connect(&button2,SIGNAL(released()),&app,SLOT(quit())); app.setMainWidget(&box); box.show(); return app.exec();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -