void configDialog::initFittingPage()
{
ApplicationWindow *app = (ApplicationWindow *)this->parent();

fitPage = new QWidget(generalDialog );

GroupBoxFittingCurve = new QButtonGroup(2,QGroupBox::Horizontal, tr("Generated Fit Curve"), fitPage );

generatePointsBtn = new QRadioButton (GroupBoxFittingCurve);
generatePointsBtn ->setText(tr("Uniform X Function"));
generatePointsBtn->setChecked(app->generateUniformFitPoints);

QHBox *hb=new QHBox(GroupBoxFittingCurve);
hb->setSpacing(5);

lblPoints = new QLabel( tr("Points"), hb);
generatePointsBox = new QSpinBox (0, 1000000, 10, hb);
generatePointsBox->setValue(app->fitPoints);
showPointsBox(!app->generateUniformFitPoints);

samePointsBtn = new QRadioButton(GroupBoxFittingCurve);
samePointsBtn->setText( tr( "Same X as Fitting Data" ) );
samePointsBtn->setChecked(!app->generateUniformFitPoints);

GroupBoxMultiPeak = new QButtonGroup(2,QGroupBox::Horizontal, tr("Display Peak Curves for Multi-peak Fits"), fitPage );
GroupBoxMultiPeak->setCheckable(true);
GroupBoxMultiPeak->setChecked(app->generatePeakCurves);

lblPeaksColor = new QLabel( tr("Peaks Color"), GroupBoxMultiPeak);
boxPeaksColor = new ColorBox (GroupBoxMultiPeak);
boxPeaksColor->setCurrentItem(app->peakCurvesColor);

GroupBoxFitParameters = new QButtonGroup(2,QGroupBox::Horizontal, tr("Parameters Output"), fitPage );

lblPrecision = new QLabel( tr("Significant Digits"), GroupBoxFitParameters);
boxPrecision = new QSpinBox (0, 15, 1, GroupBoxFitParameters);
boxPrecision->setValue (app->fit_output_precision);

logBox = new QCheckBox (tr("Write Parameters to Result Log"), GroupBoxFitParameters);
logBox->setChecked(app->writeFitResultsToLog);

new QLabel(QString::null, GroupBoxFitParameters);

plotLabelBox = new QCheckBox (tr("Paste Parameters to Plot"), GroupBoxFitParameters);
plotLabelBox->setChecked(app->pasteFitResultsToPlot);

new QLabel(QString::null, GroupBoxFitParameters);

QVBoxLayout* hlayout = new QVBoxLayout(fitPage, 5, 5);
hlayout->addWidget(GroupBoxFittingCurve);
hlayout->addWidget(GroupBoxMultiPeak);
hlayout->addWidget(GroupBoxFitParameters);

connect(samePointsBtn, SIGNAL(toggled(bool)), this, SLOT(showPointsBox(bool)));
connect(generatePointsBtn, SIGNAL(toggled(bool)), this, SLOT(showPointsBox(bool)));

appTabWidget->insertTab(fitPage, tr("Fitting"));
}
Esempio n. 2
0
void FitDialog::initAdvancedPage()
{
	ApplicationWindow *app = (ApplicationWindow *)this->parent();

	generatePointsBtn = new QRadioButton (tr("&Uniform X Function"));
	generatePointsBtn->setChecked(app->generateUniformFitPoints);
	connect( generatePointsBtn, SIGNAL(clicked()), this, SLOT(enableApplyChanges()));


    QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(generatePointsBtn, 0, 0);

	lblPoints = new QLabel( tr("Points"));

	generatePointsBox = new QSpinBox ();
    generatePointsBox->setRange(0, 1000000);
	generatePointsBox->setSingleStep(10);
	generatePointsBox->setValue(app->fitPoints);
	connect( generatePointsBox, SIGNAL(valueChanged(int)), this, SLOT(enableApplyChanges(int)));
    showPointsBox(!app->generateUniformFitPoints);

    QHBoxLayout *hb = new QHBoxLayout();
    hb->addStretch();
    hb->addWidget(lblPoints);
    hb->addWidget(generatePointsBox);
	gl1->addLayout(hb, 0, 1);

	samePointsBtn = new QRadioButton(tr( "Same X as Fitting &Data" ));
    gl1->addWidget(samePointsBtn, 1, 0);
	samePointsBtn->setChecked(!app->generateUniformFitPoints);
	connect( samePointsBtn, SIGNAL(clicked()), this, SLOT(enableApplyChanges()));

    QGroupBox *gb1 = new QGroupBox(tr("Generated Fit Curve"));
    gb1->setLayout(gl1);

    QGridLayout *gl2 = new QGridLayout();
    gl2->addWidget(new QLabel( tr("Significant Digits")), 0, 1);
	boxPrecision = new QSpinBox ();
    boxPrecision->setRange(0, 15);
	boxPrecision->setValue (app->fit_output_precision);
	connect( boxPrecision, SIGNAL(valueChanged (int)), this, SLOT(enableApplyChanges(int)));
    gl2->addWidget(boxPrecision, 0, 2);
	btnParamTable = new QPushButton(tr( "Parameters &Table" ));
    gl2->addWidget(btnParamTable, 1, 0);
	gl2->addWidget(new QLabel( tr("Name: ")), 1, 1);
	paramTableName = new QLineEdit(tr( "Parameters" ));
    gl2->addWidget(paramTableName, 1, 2);
	btnCovMatrix = new QPushButton(tr( "Covariance &Matrix" ));
    gl2->addWidget(btnCovMatrix, 2, 0);
    gl2->addWidget(new QLabel( tr("Name: ")), 2, 1);
	covMatrixName = new QLineEdit( tr( "CovMatrix" ) );
    gl2->addWidget(covMatrixName, 2, 2);

	scaleErrorsBox = new QCheckBox(tr("Scale Errors with sqrt(Chi^2/doF)"));
	scaleErrorsBox->setChecked(app->fit_scale_errors);
	connect( scaleErrorsBox, SIGNAL(stateChanged (int)), this, SLOT(enableApplyChanges(int)));

    QGroupBox *gb2 = new QGroupBox(tr("Parameters Output"));
    gb2->setLayout(gl2);

	logBox = new QCheckBox (tr("&Write Parameters to Result Log"));
	logBox->setChecked(app->writeFitResultsToLog);
	connect( logBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyChanges(int)));

	plotLabelBox = new QCheckBox (tr("&Paste Parameters to Plot"));
	plotLabelBox->setChecked(app->pasteFitResultsToPlot);
	connect( plotLabelBox, SIGNAL(stateChanged (int)), this, SLOT(enableApplyChanges(int)));

    QHBoxLayout *hbox1 = new QHBoxLayout();

	btnBack = new QPushButton(tr( "<< &Fit" ));
	connect( btnBack, SIGNAL(clicked()), this, SLOT(showFitPage()));
	connect( btnBack, SIGNAL(clicked()), this, SLOT(applyChanges()));
    hbox1->addWidget(btnBack);

	btnApply = new QPushButton(tr( "&Apply" ));
	btnApply->setEnabled(false);
	connect( btnApply, SIGNAL(clicked()), this, SLOT(applyChanges()));
    hbox1->addWidget(btnApply);

	buttonCancel3 = new QPushButton(tr( "&Close" ));
    hbox1->addWidget(buttonCancel3);
    hbox1->addStretch();

    QVBoxLayout *vbox1 = new QVBoxLayout();
    vbox1->addWidget(gb1);
    vbox1->addWidget(gb2);
	vbox1->addWidget(scaleErrorsBox);
    vbox1->addWidget(logBox);
    vbox1->addWidget(plotLabelBox);
    vbox1->addStretch();
    vbox1->addLayout(hbox1);

    advancedPage = new QWidget();
	advancedPage->setLayout(vbox1);
    tw->addWidget(advancedPage);

	connect(btnParamTable, SIGNAL(clicked()), this, SLOT(showParametersTable()));
	connect(btnCovMatrix, SIGNAL(clicked()), this, SLOT(showCovarianceMatrix()));
	connect(samePointsBtn, SIGNAL(toggled(bool)), this, SLOT(showPointsBox(bool)));
	connect(generatePointsBtn, SIGNAL(toggled(bool)), this, SLOT(showPointsBox(bool)));
	connect(buttonCancel3, SIGNAL(clicked()), this, SLOT(close()));
}