• 3360阅读
  • 0回复

改好了 [复制链接]

上一主题 下一主题
离线lishuzheng
 

只看楼主 倒序阅读 楼主  发表于: 2007-12-24
改好了
— 本帖被 XChinux 执行加亮操作(2008-07-17) —
1  #include <qapplication.h>
2  #include <qwidget.h>
3  #include <qpushbutton.h>
4  #include <qfont.h>
5  #include <qlabel.h>
6
7 class MyMainWindow : public QWidget
8 {
9    public :
10    MyMainWindow();
11    private :
12    QPushButton * b1;
13  QLabel * label;
14 };
15  MyMainWindow : :MyMainWindow()
16        {
17        setGeometry(100,100,200,170);
18        b1 = new QPushButton("Quit", this);
19        b1->setGeometry(20,20,160,80);
20        b1->setFont(QFont("Times",18,QFont::Bold));
21       
22        label=new QLabel(this);
23        label->setGeometry(10,110,180,50);
24        label->setText("If you click the button aboe,\n
25                the whole progren will exit");
26        label->setAlignment(AlignCenter);
27        connect(b1,SIGNAL(clicked()),qApp,SLOT(quit()));
28        }
29        int main(int argc,char **argv)
30        {
31        QApplication a(argc,argv);
32        MyMainWindow w;
33        a.setMainWidget (&w);
34        w.show;
35        return a.exec();
36        }


[ 此贴被lishuzheng在2007-12-24 22:20重新编辑 ]
快速回复
限100 字节
 
上一个 下一个