qt的Dialog

void Desktop::clientUpgrade()
{
    myDialog = new QDialog(this);
    myDialog->setFont(*f2);
    this->myDialog->setWindowIcon(QIcon("./images/QDKtv.png"));
    //总体布局
    qglMainWind = new QGridLayout(this);
    qglMainWind->setSpacing(6);
    qglMainWind->setContentsMargins(11, 11, 11, 11);
    myDialog->setLayout(qglMainWind);

    QLabel *ql1 = new QLabel(tr("升级向导:生成升级文件,或使用升级文件升级"));
    QLabel *ql2 = new QLabel(tr("产品名称:GrandDog"));

    this->qgbFirstSearch = new QGroupBox(this);
    this->qgbFirstSearch->setTitle("请选择");
    this->qgbFirstSearch->setMinimumHeight(50);
    QVBoxLayout *qhblFindCon = new QVBoxLayout(qgbFirstSearch);
    qrb1 = new QRadioButton(tr("请求升级文件"));
    qrb1->setChecked(true);
    qrb2 = new QRadioButton(tr("升级"));
    qhblFindCon->addWidget(qrb1);
    qhblFindCon->addWidget(qrb2);

    QHBoxLayout *qhblmain = new QHBoxLayout();
    QPushButton *qpb1 = new QPushButton(tr("下一步"));
    connect(qpb1,SIGNAL(clicked()),this,SLOT(f_sure()));
    QPushButton *qpb2 = new QPushButton(tr("取消"));
    connect(qpb2,SIGNAL(clicked()),this,SLOT(f_close()));
    qhblmain->addSpacing(150);
    qhblmain->addWidget(qpb1);
    qhblmain->addWidget(qpb2);

    qglMainWind->addWidget(ql1,0,0,1,1);
    qglMainWind->addWidget(ql2,1,0,1,1);
    qglMainWind->addWidget(qgbFirstSearch,2,0,1,1);
    qglMainWind->addLayout(qhblmain,3,0,1,1);

    this->myDialog->show();
    this->myDialog->setFixedSize(350,230);
    this->myDialog->setGeometry(350,200,0,0);
}

posted on 2012-10-23 14:15  小风儿_xf  阅读(893)  评论(0编辑  收藏  举报

导航