void ExamineResultDialog::createButtonBox() { this->button_layout = new QHBoxLayout; this->button_layout->addStretch(); this->cancel_button = new QPushButton(tr("cancel game")); connect(this->cancel_button, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked())); if (this->examine_state->total_finished < this->examine_state->total) { this->next_button = new QPushButton(tr("next game")); this->button_layout->addWidget(this->next_button); connect(this->next_button, SIGNAL(clicked()), this, SLOT(onNextButtonClicked())); } else { this->new_button = new QPushButton(tr("change gatekeeper")); this->button_layout->addWidget(this->new_button); connect(this->new_button, SIGNAL(clicked()), this, SLOT(onNewButtonClicked())); } this->button_layout->addWidget(this->cancel_button); }
NewAccountDialog::NewAccountDialog(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f), serviceManager(ServiceManager::instance()) { setWindowTitle("Add Account..."); QVBoxLayout * dialogLayout = new QVBoxLayout(this); dialogLayout->setContentsMargins(0, 0, 0, 0); dialogLayout->setSpacing(0); slideLayout = new Utopia::SlideLayout; dialogLayout->addLayout(slideLayout); dialogLayout->addStretch(1); page_one.widget = new QWidget; QGridLayout * stepOneLayout = new QGridLayout(page_one.widget); stepOneLayout->addWidget(new QLabel("Service URL:"), 0, 0); stepOneLayout->addWidget(page_one.serviceUrlLineEdit = new QLineEdit, 0, 1); stepOneLayout->addWidget(page_one.errorLabel = new QLabel, 1, 1); stepOneLayout->setColumnStretch(0, 0); stepOneLayout->setColumnStretch(1, 1); page_one.errorLabel->setObjectName("errorLabel"); slideLayout->addWidget(page_one.widget, "1"); page_two.widget = new QWidget; QGridLayout * stepTwoLayout = new QGridLayout(page_two.widget); stepTwoLayout->addWidget(new QLabel("Service:"), 0, 0); stepTwoLayout->addWidget(page_two.serviceDescription = new QLabel, 0, 1); stepTwoLayout->addWidget(new QLabel("Account Type:"), 1, 0); stepTwoLayout->addWidget(page_two.authenticationMethodComboBox = new QComboBox, 1, 1); stepTwoLayout->setColumnStretch(0, 0); stepTwoLayout->setColumnStretch(1, 1); slideLayout->addWidget(page_two.widget, "2"); page_three.widget = new QWidget; QGridLayout * stepThreeLayout = new QGridLayout(page_three.widget); stepThreeLayout->addWidget(new QLabel("Service:"), 0, 0); stepThreeLayout->addWidget(page_three.serviceDescription = new QLabel, 0, 1); stepThreeLayout->addWidget(new QLabel("Account Type:"), 1, 0); stepThreeLayout->addWidget(page_three.authenticationMethod = new QLabel, 1, 1); stepThreeLayout->setColumnStretch(0, 0); stepThreeLayout->setColumnStretch(1, 1); slideLayout->addWidget(page_three.widget, "3"); slideLayout->push("1", false); QHBoxLayout * buttonLayout = new QHBoxLayout; buttonLayout->setContentsMargins(12, 4, 12, 12); buttonLayout->setSpacing(6); nextButton = new QPushButton("Next", this); previousButton = new QPushButton("Back", this); previousButton->hide(); cancelButton = new QPushButton("Cancel", this); doneButton = new QPushButton("Done", this); doneButton->hide(); buttonLayout->addWidget(previousButton); buttonLayout->addSpacing(10); buttonLayout->addStretch(1); buttonLayout->addWidget(cancelButton); buttonLayout->addWidget(doneButton); buttonLayout->addWidget(nextButton); connect(previousButton, SIGNAL(clicked()), this, SLOT(onPreviousButtonClicked())); connect(nextButton, SIGNAL(clicked()), this, SLOT(onNextButtonClicked())); connect(doneButton, SIGNAL(clicked()), this, SLOT(onDoneButtonClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); dialogLayout->addLayout(buttonLayout); }