QVBoxLayout * Soma::createSomaBoxLayout()
{
	QVBoxLayout * vBox = new QVBoxLayout();

	QRegExp rePopSize("[1-9]{1}[0-9]{0,3}");
	QRegExpValidator * validator1to9999 = new QRegExpValidator(rePopSize, 0);
	QRegExp reStep("[0-9]{1,3}[.]{0,1}[0-9]{1,3}");
	QRegExpValidator * validatorStepPath = new QRegExpValidator(reStep, 0);
	QRegExp rePRT("[0-1]{1}[.]{1}[0-9]{1,2}");
	QRegExpValidator * validatorPRT = new QRegExpValidator( rePRT, 0);
	QRegExp reAccError("[0-9]{1,4}[.]{0,1}[0-9]{1,5}");
	QRegExpValidator * validatorAccError = new QRegExpValidator( reAccError, 0);

	QLabel * popSizeLabel = new QLabel(tr("Population size"));
	popSizeLine = new QLineEdit();
	popSizeLine->setValidator(validator1to9999);

	QLabel * stepLabel = new QLabel(tr("Step"));
	stepLine = new QLineEdit();
	stepLine->setValidator(validatorStepPath);

	QLabel * pathLenghtLabel = new QLabel(tr("Path length"));
	pathLenghtLine = new QLineEdit();
	pathLenghtLine->setValidator( validatorStepPath );

	QLabel * PRTLabel = new QLabel(tr("PRT"));
	PRTLine = new QLineEdit();
	PRTLine->setValidator( validatorPRT );

	accErrorCheckBox = new QCheckBox(tr("Accuracy Error"));
	accErrorLine = new QLineEdit();
	accErrorLine->setValidator( validatorAccError );
	accErrorLine->setEnabled(false);

	accErrorLine->setVisible(false);
	accErrorCheckBox->setVisible(false);

	QLabel * MigrationsLabel = new QLabel(tr("Migrations"));
	migrationsLine = new QLineEdit();
	migrationsLine->setValidator( validator1to9999 );

	saveButton = new QPushButton(tr("&Save SOMA settings"));

	vBox->addWidget(MigrationsLabel);
	vBox->addWidget(migrationsLine);
	vBox->addWidget(popSizeLabel);
	vBox->addWidget(popSizeLine);
	vBox->addWidget(stepLabel);
	vBox->addWidget(stepLine);
	vBox->addWidget(pathLenghtLabel);
	vBox->addWidget(pathLenghtLine);
	vBox->addWidget(PRTLabel);
	vBox->addWidget(PRTLine);
	vBox->addWidget(accErrorCheckBox);
	vBox->addWidget(accErrorLine);
	vBox->addWidget(saveButton);

	vBox->stretch(1);
	return vBox;
}
Example #2
0
void MainWindow::populateLineGraphActorsList()
{
    QCheckBox * actor;
    lineGraphActorsCheckBoxList.clear();
    lineGraphCheckedActorsIdList.clear();
    lineActorCBList.clear();

    QWidget* widget = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout(widget);

    for(int actorsCount = 0; actorsCount < actorsName.count(); ++actorsCount)
    {
        actor = new QCheckBox(actorsName.at(actorsCount));
        actor->setChecked(true);

        QColor mycolor = colorsList.at(actorsCount);

        QString style = "background: rgb(%1, %2, %3);";
        style = style.arg(mycolor.red()).arg(mycolor.green()).arg(mycolor.blue());
        style += "color:white; font-size:15px;";
        style += "font-weight:bold;";

        actor->setStyleSheet(style);

        actor->setObjectName(QString::number(actorsCount));

        layout->addWidget(actor);
        layout->stretch(0);

        lineGraphActorsCheckBoxList.append(actor);

        //setting all checkboxes as checked as initial condition
        lineGraphCheckedActorsIdList.append(true);
        connect(actor,SIGNAL(toggled(bool)),this,SLOT(lineGraphActorsCheckboxClicked(bool)));
        lineActorCBList.append(actor);
    }

    lineGraphActorsScrollArea->setWidget(widget);
}