void DomainDialog::initDialog() { ui->setupUi(this); //Connect signals to their handlers, and make sure all fields are properly filled connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(ui->nameEdit, SIGNAL(textChanged(QString)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->displayNameEdit, SIGNAL(textChanged(QString)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->iconButton, SIGNAL(clicked()), this, SLOT(onIconClicked())); onMandatoryFieldsChanged(); //Setup the line edits ui->nameEdit->setFocus(Qt::PopupFocusReason); ui->nameEdit->setValidationExpression(".+"); ui->displayNameEdit->setValidationExpression(".+"); //Little hack to make the layout look better for(int i=0; i<ui->gridLayout->rowCount(); ++i) ui->gridLayout->setRowMinimumHeight(i, ui->displayNameEdit->geometry().height()); ui->gridLayout->update(); //Set the range and value of the sliders based on Domain's defaults ui->confidentialitySlider->setRange(Domain::ConfidentialityMin, Domain::ConfidentialityMax); ui->reliabilitySlider->setRange(Domain::ReliabilityMin, Domain::ReliabilityMax); //Another hack to force the sliders' associated labels' text to be updated ui->confidentialityLabel->setNum(ui->confidentialitySlider->value()); ui->reliabilityLabel->setNum(ui->reliabilitySlider->value()); }
void MRuleDialog::initDialog() { ui->setupUi(this); //Resizing and sorting of widgets ui->variableBox->setInsertPolicy(QComboBox::InsertAlphabetically); ui->propList->header()->setResizeMode(0, QHeaderView::ResizeToContents); //Make sure the button is enabled only when rules have been added ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); //Hide description labels for now ui->actionDescLabel->hide(); ui->valueDescLabel->hide(); //Add the actions list and fill the variables list according to the selected action QList<ProgramAction> actList=_prog.actions(); for(int i=0; i<actList.size(); i++) ui->actionBox->addItem(actList[i].displayName(), actList[i].name()); connect(ui->actionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onActionChanged(int))); ui->actionBox->insertItem(0, UndefinedAction); ui->actionBox->setCurrentIndex(0); //Setup the variables combobox and use the variable changed handler to initialise the editor widget connect(ui->variableBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onVariableChanged(QString))); onVariableChanged(QString()); //Various signals for dialog buttons, mandatory fields, tree widget related buttons connect(ui->propAddButton, SIGNAL(clicked()), this, SLOT(onCondAddButtonClicked())); connect(ui->propRemoveButton, SIGNAL(clicked()), this, SLOT(onCondRemoveButtonClicked())); connect(ui->variableBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->valueLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->valueComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->valueCheckBox, SIGNAL(clicked()), this, SLOT(onMandatoryFieldsChanged())); connect(ui->valueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->propList, SIGNAL(itemSelectionChanged()), this, SLOT(onCondListSelectionChanged())); onMandatoryFieldsChanged(); onCondListSelectionChanged(); }