void XYFourierTransformCurveDock::initGeneralTab() { //if there are more then one curve in the list, disable the tab "general" if (m_curvesList.size()==1) { uiGeneralTab.lName->setEnabled(true); uiGeneralTab.leName->setEnabled(true); uiGeneralTab.lComment->setEnabled(true); uiGeneralTab.leComment->setEnabled(true); uiGeneralTab.leName->setText(m_curve->name()); uiGeneralTab.leComment->setText(m_curve->comment()); }else { uiGeneralTab.lName->setEnabled(false); uiGeneralTab.leName->setEnabled(false); uiGeneralTab.lComment->setEnabled(false); uiGeneralTab.leComment->setEnabled(false); uiGeneralTab.leName->setText(""); uiGeneralTab.leComment->setText(""); } //show the properties of the first curve m_transformCurve = dynamic_cast<XYFourierTransformCurve*>(m_curve); Q_ASSERT(m_transformCurve); XYCurveDock::setModelIndexFromColumn(cbXDataColumn, m_transformCurve->xDataColumn()); XYCurveDock::setModelIndexFromColumn(cbYDataColumn, m_transformCurve->yDataColumn()); uiGeneralTab.cbAutoRange->setChecked(m_transformData.autoRange); uiGeneralTab.sbMin->setValue(m_transformData.xRange.first()); uiGeneralTab.sbMax->setValue(m_transformData.xRange.last()); this->autoRangeChanged(); uiGeneralTab.cbWindowType->setCurrentIndex(m_transformData.windowType); this->windowTypeChanged(); uiGeneralTab.cbType->setCurrentIndex(m_transformData.type); this->typeChanged(); uiGeneralTab.cbTwoSided->setChecked(m_transformData.twoSided); this->twoSidedChanged(); // show/hide shifted check box uiGeneralTab.cbShifted->setChecked(m_transformData.shifted); this->shiftedChanged(); uiGeneralTab.cbXScale->setCurrentIndex(m_transformData.xScale); this->xScaleChanged(); this->showTransformResult(); //enable the "recalculate"-button if the source data was changed since the last transform uiGeneralTab.pbRecalculate->setEnabled(m_transformCurve->isSourceDataChangedSinceLastTransform()); uiGeneralTab.chkVisible->setChecked( m_curve->isVisible() ); //Slots connect(m_transformCurve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(curveDescriptionChanged(const AbstractAspect*))); connect(m_transformCurve, SIGNAL(xDataColumnChanged(const AbstractColumn*)), this, SLOT(curveXDataColumnChanged(const AbstractColumn*))); connect(m_transformCurve, SIGNAL(yDataColumnChanged(const AbstractColumn*)), this, SLOT(curveYDataColumnChanged(const AbstractColumn*))); connect(m_transformCurve, SIGNAL(transformDataChanged(XYFourierTransformCurve::TransformData)), this, SLOT(curveTransformDataChanged(XYFourierTransformCurve::TransformData))); connect(m_transformCurve, SIGNAL(sourceDataChangedSinceLastTransform()), this, SLOT(enableRecalculate())); }
/*! * // Tab "General" */ void XYFitCurveDock::setupGeneral() { QWidget* generalTab = new QWidget(ui.tabGeneral); uiGeneralTab.setupUi(generalTab); QGridLayout* gridLayout = dynamic_cast<QGridLayout*>(generalTab->layout()); if (gridLayout) { gridLayout->setContentsMargins(2,2,2,2); gridLayout->setHorizontalSpacing(2); gridLayout->setVerticalSpacing(2); } cbXDataColumn = new TreeViewComboBox(generalTab); gridLayout->addWidget(cbXDataColumn, 4, 4, 1, 2); cbYDataColumn = new TreeViewComboBox(generalTab); gridLayout->addWidget(cbYDataColumn, 5, 4, 1, 2); cbWeightsColumn = new TreeViewComboBox(generalTab); gridLayout->addWidget(cbWeightsColumn, 6, 4, 1, 2); uiGeneralTab.cbModel->addItem(i18n("Polynomial")); uiGeneralTab.cbModel->addItem(i18n("Power")); uiGeneralTab.cbModel->addItem(i18n("Exponential")); uiGeneralTab.cbModel->addItem(i18n("Inverse Exponential")); uiGeneralTab.cbModel->addItem(i18n("Fourier")); uiGeneralTab.cbModel->addItem(i18n("Gaussian")); uiGeneralTab.cbModel->addItem(i18n("Lorentz (Cauchy)")); uiGeneralTab.cbModel->addItem(i18n("Maxwell-Boltzmann")); uiGeneralTab.cbModel->addItem(i18n("Sigmoid")); uiGeneralTab.cbModel->addItem(i18n("Custom")); uiGeneralTab.teEquation->setMaximumHeight(uiGeneralTab.leName->sizeHint().height()*2); uiGeneralTab.tbConstants->setIcon( KIcon("labplot-format-text-symbol") ); uiGeneralTab.tbFunctions->setIcon( KIcon("preferences-desktop-font") ); uiGeneralTab.pbRecalculate->setIcon(KIcon("run-build")); QHBoxLayout* layout = new QHBoxLayout(ui.tabGeneral); layout->setMargin(0); layout->addWidget(generalTab); //Slots connect( uiGeneralTab.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) ); connect( uiGeneralTab.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged()) ); connect( uiGeneralTab.chkVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); connect( uiGeneralTab.cbModel, SIGNAL(currentIndexChanged(int)), this, SLOT(modelChanged(int)) ); connect( uiGeneralTab.sbDegree, SIGNAL(valueChanged(int)), this, SLOT(updateModelEquation()) ); connect( uiGeneralTab.teEquation, SIGNAL(expressionChanged()), this, SLOT(enableRecalculate()) ); connect( uiGeneralTab.tbConstants, SIGNAL(clicked()), this, SLOT(showConstants()) ); connect( uiGeneralTab.tbFunctions, SIGNAL(clicked()), this, SLOT(showFunctions()) ); connect( uiGeneralTab.pbParameters, SIGNAL(clicked()), this, SLOT(showParameters()) ); connect( uiGeneralTab.pbOptions, SIGNAL(clicked()), this, SLOT(showOptions()) ); connect( uiGeneralTab.pbRecalculate, SIGNAL(clicked()), this, SLOT(recalculateClicked()) ); }
void XYFourierFilterCurveDock::initGeneralTab() { //if there are more then one curve in the list, disable the tab "general" if (m_curvesList.size()==1){ uiGeneralTab.lName->setEnabled(true); uiGeneralTab.leName->setEnabled(true); uiGeneralTab.lComment->setEnabled(true); uiGeneralTab.leComment->setEnabled(true); uiGeneralTab.leName->setText(m_curve->name()); uiGeneralTab.leComment->setText(m_curve->comment()); }else { uiGeneralTab.lName->setEnabled(false); uiGeneralTab.leName->setEnabled(false); uiGeneralTab.lComment->setEnabled(false); uiGeneralTab.leComment->setEnabled(false); uiGeneralTab.leName->setText(""); uiGeneralTab.leComment->setText(""); } //show the properties of the first curve m_filterCurve = dynamic_cast<XYFourierFilterCurve*>(m_curve); Q_ASSERT(m_filterCurve); XYCurveDock::setModelIndexFromColumn(cbXDataColumn, m_filterCurve->xDataColumn()); XYCurveDock::setModelIndexFromColumn(cbYDataColumn, m_filterCurve->yDataColumn()); uiGeneralTab.cbType->setCurrentIndex(m_filterData.type); this->typeChanged(m_filterData.type); uiGeneralTab.cbForm->setCurrentIndex(m_filterData.form); this->formChanged(m_filterData.form); uiGeneralTab.sbOrder->setValue(m_filterData.order); uiGeneralTab.cbUnit->setCurrentIndex(m_filterData.unit); this->unitChanged(m_filterData.unit); // after unit has set uiGeneralTab.sbCutoff->setValue(m_filterData.cutoff); uiGeneralTab.cbUnit2->setCurrentIndex(m_filterData.unit2); this->unit2Changed(m_filterData.unit2); // after unit has set uiGeneralTab.sbCutoff2->setValue(m_filterData.cutoff2); this->showFilterResult(); //enable the "recalculate"-button if the source data was changed since the last filter uiGeneralTab.pbRecalculate->setEnabled(m_filterCurve->isSourceDataChangedSinceLastFilter()); uiGeneralTab.chkVisible->setChecked( m_curve->isVisible() ); //Slots connect(m_filterCurve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(curveDescriptionChanged(const AbstractAspect*))); connect(m_filterCurve, SIGNAL(xDataColumnChanged(const AbstractColumn*)), this, SLOT(curveXDataColumnChanged(const AbstractColumn*))); connect(m_filterCurve, SIGNAL(yDataColumnChanged(const AbstractColumn*)), this, SLOT(curveYDataColumnChanged(const AbstractColumn*))); connect(m_filterCurve, SIGNAL(filterDataChanged(XYFourierFilterCurve::FilterData)), this, SLOT(curveFilterDataChanged(XYFourierFilterCurve::FilterData))); connect(m_filterCurve, SIGNAL(sourceDataChangedSinceLastFilter()), this, SLOT(enableRecalculate())); }
void XYFitCurveDock::showOptions() { QMenu menu; FitOptionsWidget w(&menu, &m_fitData); connect(&w, SIGNAL(finished()), &menu, SLOT(close())); connect(&w, SIGNAL(optionsChanged()), this, SLOT(enableRecalculate())); QWidgetAction* widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(&w); menu.addAction(widgetAction); QPoint pos(-menu.sizeHint().width()+uiGeneralTab.pbParameters->width(),-menu.sizeHint().height()); menu.exec(uiGeneralTab.pbOptions->mapToGlobal(pos)); }
void XYFourierTransformCurveDock::twoSidedChanged() { bool twoSided = uiGeneralTab.cbTwoSided->isChecked(); m_transformData.twoSided = twoSided; if (twoSided) uiGeneralTab.cbShifted->setEnabled(true); else { uiGeneralTab.cbShifted->setEnabled(false); uiGeneralTab.cbShifted->setChecked(false); } enableRecalculate(); }
void XYFitCurveDock::initGeneralTab() { //if there are more then one curve in the list, disable the tab "general" if (m_curvesList.size()==1){ uiGeneralTab.lName->setEnabled(true); uiGeneralTab.leName->setEnabled(true); uiGeneralTab.lComment->setEnabled(true); uiGeneralTab.leComment->setEnabled(true); uiGeneralTab.leName->setText(m_curve->name()); uiGeneralTab.leComment->setText(m_curve->comment()); }else { uiGeneralTab.lName->setEnabled(false); uiGeneralTab.leName->setEnabled(false); uiGeneralTab.lComment->setEnabled(false); uiGeneralTab.leComment->setEnabled(false); uiGeneralTab.leName->setText(""); uiGeneralTab.leComment->setText(""); } //show the properties of the first curve m_fitCurve = dynamic_cast<XYFitCurve*>(m_curve); Q_ASSERT(m_fitCurve); XYCurveDock::setModelIndexFromColumn(cbXDataColumn, m_fitCurve->xDataColumn()); XYCurveDock::setModelIndexFromColumn(cbYDataColumn, m_fitCurve->yDataColumn()); XYCurveDock::setModelIndexFromColumn(cbWeightsColumn, m_fitCurve->weightsColumn()); uiGeneralTab.cbModel->setCurrentIndex(m_fitData.modelType); this->modelChanged(m_fitData.modelType); uiGeneralTab.sbDegree->setValue(m_fitData.degree); this->showFitResult(); //enable the "recalculate"-button if the source data was changed since the last fit uiGeneralTab.pbRecalculate->setEnabled(m_fitCurve->isSourceDataChangedSinceLastFit()); uiGeneralTab.chkVisible->setChecked( m_curve->isVisible() ); //Slots connect(m_fitCurve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(curveDescriptionChanged(const AbstractAspect*))); connect(m_fitCurve, SIGNAL(xDataColumnChanged(const AbstractColumn*)), this, SLOT(curveXDataColumnChanged(const AbstractColumn*))); connect(m_fitCurve, SIGNAL(yDataColumnChanged(const AbstractColumn*)), this, SLOT(curveYDataColumnChanged(const AbstractColumn*))); connect(m_fitCurve, SIGNAL(weightsColumnChanged(const AbstractColumn*)), this, SLOT(curveWeightsColumnChanged(const AbstractColumn*))); connect(m_fitCurve, SIGNAL(fitDataChanged(XYFitCurve::FitData)), this, SLOT(curveFitDataChanged(XYFitCurve::FitData))); connect(m_fitCurve, SIGNAL(sourceDataChangedSinceLastFit()), this, SLOT(enableRecalculate())); }
/*! * called when parameter names and/or start values for the custom model were changed */ void XYFitCurveDock::parametersChanged() { //parameter names were (probably) changed -> set the new names in EquationTextEdit uiGeneralTab.teEquation->setVariables(m_fitData.paramNames); enableRecalculate(); }
void XYFourierTransformCurveDock::xScaleChanged() { nsl_dft_xscale xScale = (nsl_dft_xscale)uiGeneralTab.cbXScale->currentIndex(); m_transformData.xScale = xScale; enableRecalculate(); }
void XYFourierTransformCurveDock::shiftedChanged() { bool shifted = uiGeneralTab.cbShifted->isChecked(); m_transformData.shifted = shifted; enableRecalculate(); }
void XYFourierTransformCurveDock::typeChanged() { nsl_dft_result_type type = (nsl_dft_result_type)uiGeneralTab.cbType->currentIndex(); m_transformData.type = type; enableRecalculate(); }
void XYFourierTransformCurveDock::windowTypeChanged() { nsl_sf_window_type windowType = (nsl_sf_window_type)uiGeneralTab.cbWindowType->currentIndex(); m_transformData.windowType = windowType; enableRecalculate(); }
void XYDifferentiationCurveDock::initGeneralTab() { //if there are more then one curve in the list, disable the tab "general" if (m_curvesList.size()==1) { uiGeneralTab.lName->setEnabled(true); uiGeneralTab.leName->setEnabled(true); uiGeneralTab.lComment->setEnabled(true); uiGeneralTab.leComment->setEnabled(true); uiGeneralTab.leName->setText(m_curve->name()); uiGeneralTab.leComment->setText(m_curve->comment()); }else { uiGeneralTab.lName->setEnabled(false); uiGeneralTab.leName->setEnabled(false); uiGeneralTab.lComment->setEnabled(false); uiGeneralTab.leComment->setEnabled(false); uiGeneralTab.leName->setText(""); uiGeneralTab.leComment->setText(""); } //show the properties of the first curve if (m_curve != 0) m_differentiationCurve = dynamic_cast<XYDifferentiationCurve*>(m_curve); Q_ASSERT(m_differentiationCurve); uiGeneralTab.cbDataSourceType->setCurrentIndex(m_differentiationCurve->dataSourceType()); this->dataSourceTypeChanged(uiGeneralTab.cbDataSourceType->currentIndex()); XYCurveDock::setModelIndexFromAspect(cbDataSourceCurve, m_differentiationCurve->dataSourceCurve()); XYCurveDock::setModelIndexFromAspect(cbXDataColumn, m_differentiationCurve->xDataColumn()); XYCurveDock::setModelIndexFromAspect(cbYDataColumn, m_differentiationCurve->yDataColumn()); uiGeneralTab.cbAutoRange->setChecked(m_differentiationData.autoRange); uiGeneralTab.sbMin->setValue(m_differentiationData.xRange.first()); uiGeneralTab.sbMax->setValue(m_differentiationData.xRange.last()); this->autoRangeChanged(); // update list of selectable types xDataColumnChanged(cbXDataColumn->currentModelIndex()); uiGeneralTab.cbDerivOrder->setCurrentIndex(m_differentiationData.derivOrder); this->derivOrderChanged(); uiGeneralTab.sbAccOrder->setValue(m_differentiationData.accOrder); this->accOrderChanged(); this->showDifferentiationResult(); //enable the "recalculate"-button if the source data was changed since the last differentiation uiGeneralTab.pbRecalculate->setEnabled(m_differentiationCurve->isSourceDataChangedSinceLastDifferentiation()); uiGeneralTab.chkVisible->setChecked( m_curve->isVisible() ); //Slots connect(m_differentiationCurve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(curveDescriptionChanged(const AbstractAspect*))); connect(m_differentiationCurve, SIGNAL(dataSourceCurveChanged(const XYCurve*)), this, SLOT(curveDataSourceCurveChanged(const XYCurve*))); connect(m_differentiationCurve, SIGNAL(xDataColumnChanged(const AbstractColumn*)), this, SLOT(curveXDataColumnChanged(const AbstractColumn*))); connect(m_differentiationCurve, SIGNAL(yDataColumnChanged(const AbstractColumn*)), this, SLOT(curveYDataColumnChanged(const AbstractColumn*))); connect(m_differentiationCurve, SIGNAL(differentiationDataChanged(XYDifferentiationCurve::DifferentiationData)), this, SLOT(curveDifferentiationDataChanged(XYDifferentiationCurve::DifferentiationData))); connect(m_differentiationCurve, SIGNAL(sourceDataChangedSinceLastDifferentiation()), this, SLOT(enableRecalculate())); }
void XYInterpolationCurveDock::initGeneralTab() { //if there are more then one curve in the list, disable the tab "general" if (m_curvesList.size()==1){ uiGeneralTab.lName->setEnabled(true); uiGeneralTab.leName->setEnabled(true); uiGeneralTab.lComment->setEnabled(true); uiGeneralTab.leComment->setEnabled(true); uiGeneralTab.leName->setText(m_curve->name()); uiGeneralTab.leComment->setText(m_curve->comment()); }else { uiGeneralTab.lName->setEnabled(false); uiGeneralTab.leName->setEnabled(false); uiGeneralTab.lComment->setEnabled(false); uiGeneralTab.leComment->setEnabled(false); uiGeneralTab.leName->setText(""); uiGeneralTab.leComment->setText(""); } //show the properties of the first curve m_interpolationCurve = dynamic_cast<XYInterpolationCurve*>(m_curve); Q_ASSERT(m_interpolationCurve); XYCurveDock::setModelIndexFromColumn(cbXDataColumn, m_interpolationCurve->xDataColumn()); XYCurveDock::setModelIndexFromColumn(cbYDataColumn, m_interpolationCurve->yDataColumn()); // update list of selectable types xDataColumnChanged(cbXDataColumn->currentModelIndex()); uiGeneralTab.cbType->setCurrentIndex(m_interpolationData.type); this->typeChanged(m_interpolationData.type); uiGeneralTab.cbVariant->setCurrentIndex(m_interpolationData.variant); this->variantChanged(m_interpolationData.variant); uiGeneralTab.sbTension->setValue(m_interpolationData.tension); uiGeneralTab.sbContinuity->setValue(m_interpolationData.continuity); uiGeneralTab.sbBias->setValue(m_interpolationData.bias); uiGeneralTab.cbEval->setCurrentIndex(m_interpolationData.evaluate); uiGeneralTab.sbPoints->setValue(m_interpolationData.npoints); this->showInterpolationResult(); //enable the "recalculate"-button if the source data was changed since the last interpolation uiGeneralTab.pbRecalculate->setEnabled(m_interpolationCurve->isSourceDataChangedSinceLastInterpolation()); uiGeneralTab.chkVisible->setChecked( m_curve->isVisible() ); //Slots connect(m_interpolationCurve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(curveDescriptionChanged(const AbstractAspect*))); connect(m_interpolationCurve, SIGNAL(xDataColumnChanged(const AbstractColumn*)), this, SLOT(curveXDataColumnChanged(const AbstractColumn*))); connect(m_interpolationCurve, SIGNAL(yDataColumnChanged(const AbstractColumn*)), this, SLOT(curveYDataColumnChanged(const AbstractColumn*))); connect(m_interpolationCurve, SIGNAL(interpolationDataChanged(XYInterpolationCurve::InterpolationData)), this, SLOT(curveInterpolationDataChanged(XYInterpolationCurve::InterpolationData))); connect(m_interpolationCurve, SIGNAL(sourceDataChangedSinceLastInterpolation()), this, SLOT(enableRecalculate())); }