|
楼主 |
发表于 2004-5-25 02:16:23
|
显示全部楼层
已经搞定了,其实并不是简单的按照第一个放第二个就可以的。
下面是设计四个按钮的程序的一部分,有兴趣的可以看一下:
ShowFile::ShowFile(QWidget *parent,const char *name):QWidget(parent,name)
{
QPushButton *button;
QVBoxLayout *box=new QVBoxLayout(this,3);
filelabel=new QLabel(" ",this);
filelabel->setAlignment(Qt::AlignHCenter);
box->addWidget(filelabel);
button=new QPushButton("Select Open File",this);
box->addWidget(button);
connect(button,SIGNAL(clicked()),this,SLOT(pOpen()));
button=new QPushButton("Select Save File",this);
box->addWidget(button);
connect(button,SIGNAL(clicked()),this,SLOT(pSave()));
button=new QPushButton("Select Directory",this);
box->addWidget(button);
connect(button,SIGNAL(clicked()),this,SLOT(pDirectory()));
button=new QPushButton("Filter Selection",this);
box->addWidget(button);
connect(button,SIGNAL(clicked()),this,SLOT(pFilter()));
resize(100,100);
box->activate();
} |
|