QtÎÊÌâ
ÎÒ¸Õѧ£¬ÏÂÃæÐ¡³ÌÐòµÄÄ¿µÄÊÇΪÁ˰ÑÁ½¸ö°´Å¥×°ÔÚÒ»¸ö´°¿ÚÀµ«ÊDz»¶ÔÖ÷£¬ÇóÀß¡£(S:gB j?`^|#include <qapplication.h>\O`1Xv3I? k
#include <qpushbutton.h>
YRTh-nY
E&n9m:\2J
int main( int argc, char **argv )
{
QApplication a( argc, argv );
b"G?Oix.jk#\
QPushButton hello( "Hello world!", 0 );
QPushButton quit("Quit!",0);b_4? R1~c
hello.resize( 100, 30 );VA$r Wl)v
quit.resize(100,30);^)}%S"u A]
a.setMainWideget(&hello);
a.setMainWideget(&quit);
hello.show();C*\{J3eZ8j
quit.show();
return a.exec();u p J8cD
n7uoqPq,D ME*C5cJ}?
} 1,Äã³ÌÐòµÄÃüÁîÓôí,Ϊa.setMainWidget();
2,ÏÂÃæµÄ³ÌÐò¿ÉÒÔʵÏÖÄãµÄÒªÇó:
#include <qapplication.h>
#include <qpushbutton.h>
#include <qlayout.h>
int main( int argc, char **argv )mo:t~`_kO:r
{
QApplication a( argc, argv );,Gp"P[*lj
QWidget *f = new QWidget();
QPushButton hello( "Hello world!",f );r0`:vI0Z
QPushButton quit("Quit!",f);
QBoxLayout *l = new QVBoxLayout( f );
l->addWidget( &hello );O.Xd)n~;G.|d
l->addWidget( &quit );o"H9YI4Ygd8YV
a.setMainWidget(f);
f->resize( 200, 100 );
f->show();
return a.exec();.LF _ wr"rc L
}
Ò³:
[1]