main.cpp

来自「一大堆的qt程序,在qte2.3.7下全部可以很好地运行」· C++ 代码 · 共 34 行

CPP
34
字号
#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 + =
减小字号Ctrl + -
显示快捷键?