FitDialog.h
Go to the documentation of this file.
/***************************************************************************
File : FitDialog.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2004 - 2011 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Fit Wizard
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef FITDIALOG_H
#define FITDIALOG_H
#include <Graph.h>
#include <QDoubleSpinBox>
#include <QCheckBox>
class QPushButton;
class QLineEdit;
class QComboBox;
class QStackedWidget;
class QWidget;
class QTextEdit;
class QListWidget;
class QTableWidget;
class QSpinBox;
class QLabel;
class QRadioButton;
class QLineEdit;
class ColorButton;
class Fit;
class Table;
class DoubleSpinBox;
class FunctionCurve;
class MdiSubWindow;
class ScriptEdit;
class FitDialog : public QDialog
{
Q_OBJECT
public:
FitDialog(Graph *g, QWidget* parent = 0);
void setSrcTables(QList<MdiSubWindow*> tables);
protected:
void closeEvent (QCloseEvent * e );
void initFitPage();
void initEditPage();
void initAdvancedPage();
void chooseFitModelsFolder();
void choosePluginsFolder();
private slots:
void accept();
void resetFunction();
void showFitPage();
void showEditPage();
void showAdvancedPage();
void showFunctionsList(int category);
void showParseFunctions();
void showExpression(int function);
void addFunction();
void addFunctionName();
void setFunction(bool ok);
void saveUserFunction();
void removeUserFunction();
void setGraph(Graph *g);
void activateCurve(const QString&);
void chooseFolder();
void changeDataRange();
void selectSrcTable(int tabnr);
void enableWeightingParameters(int index);
void showPointsBox(bool);
void showParametersTable();
void showCovarianceMatrix();
void showResiduals();
void showConfidenceLimits();
void showPredictionLimits();
void applyChanges();
void deleteFitCurves();
void enableApplyChanges(int = 0);
void setNumPeaks(int peaks);
void saveInitialGuesses();
void loadInitialGuesses();
void guessInitialValues();
void returnToFitPage();
void updatePreview();
void updatePreviewColor(const QColor &);
void showPreview(bool on);
void showParameterRange(bool);
void guessParameters();
private:
void loadPlugins();
void loadUserFunctions();
void initBuiltInFunctions();
void modifyGuesses(double* initVal);
QStringList builtInFunctionNames();
QStringList userFunctionNames();
QStringList plugInNames();
QString parseFormula(const QString& s);
void setEditorTextColor(const QColor& c);
void setCurrentFit(int);
Fit *d_current_fit;
Graph *d_graph;
QPointer <Table> d_param_table;
QList <Fit*> d_user_functions, d_built_in_functions, d_plugins;
QList <QwtPlotCurve*> d_result_curves;
QList <MdiSubWindow*> srcTables;
FunctionCurve *d_preview_curve;
QCheckBox* boxUseBuiltIn;
QStackedWidget* tw;
QPushButton* buttonOk;
QPushButton* buttonCancel1;
QPushButton* buttonCancel2;
QPushButton* buttonCancel3;
QPushButton* buttonAdvanced;
QPushButton* buttonClear;
QPushButton* buttonPlugins;
QPushButton* btnBack;
QPushButton* btnSaveGuesses, *btnLoadGuesses, *btnGuess;
QComboBox* boxCurve;
QComboBox* boxAlgorithm;
QTableWidget* boxParams;
DoubleSpinBox* boxFrom;
DoubleSpinBox* boxTo;
DoubleSpinBox* boxTolerance;
QSpinBox* boxPoints, *generatePointsBox, *boxPrecision, *polynomOrderBox;
QWidget *fitPage, *editPage, *advancedPage;
ScriptEdit *editBox;
QTextEdit *explainBox, *boxFunction;
QListWidget *categoryBox, *funcBox;
QLineEdit *boxName;
QLabel *boxErrorMsg, *boxParam;
QLabel *lblFunction, *lblPoints, *polynomOrderLabel;
QPushButton *btnAddFunc, *btnDelFunc, *btnContinue, *btnApply;
QPushButton *buttonEdit, *btnAddTxt, *btnAddName, *btnDeleteFitCurves;
ColorButton* boxColor;
QComboBox *boxWeighting, *tableNamesBox, *colNamesBox;
QRadioButton *generatePointsBtn, *samePointsBtn;
QPushButton *btnParamTable, *btnCovMatrix, *btnParamRange;
QPushButton *btnResiduals, *btnConfidenceLimits, *btnPredictionLimits;
DoubleSpinBox *boxConfidenceLevel;
QLineEdit *covMatrixName, *paramTableName;
QCheckBox *plotLabelBox, *logBox, *scaleErrorsBox, *globalParamTableBox;
QCheckBox *previewBox;
};
#endif // FITDIALOG_H
FitDialog::boxAlgorithm
QComboBox * boxAlgorithm
Definition: FitDialog.h:153
FitDialog::showPointsBox
void showPointsBox(bool)
Definition: FitDialog.cpp:818
FitDialog::showExpression
void showExpression(int function)
Definition: FitDialog.cpp:1278
FitDialog::setEditorTextColor
void setEditorTextColor(const QColor &c)
Definition: FitDialog.cpp:1977
FitDialog::initAdvancedPage
void initAdvancedPage()
Definition: FitDialog.cpp:581
FitDialog::setCurrentFit
void setCurrentFit(int)
Definition: FitDialog.cpp:1256
FitDialog::addFunctionName
void addFunctionName()
Definition: FitDialog.cpp:1341
FitDialog::showPreview
void showPreview(bool on)
Definition: FitDialog.cpp:1816
FitDialog::activateCurve
void activateCurve(const QString &)
Definition: FitDialog.cpp:847
FitDialog::boxColor
ColorButton * boxColor
Definition: FitDialog.h:168
FitDialog::boxTolerance
DoubleSpinBox * boxTolerance
Definition: FitDialog.h:157
FitDialog::changeDataRange
void changeDataRange()
Definition: FitDialog.cpp:1517
FitDialog::polynomOrderBox
QSpinBox * polynomOrderBox
Definition: FitDialog.h:158
FitDialog::guessInitialValues
void guessInitialValues()
Definition: FitDialog.cpp:1781
FitDialog::loadPlugins
void loadPlugins()
Definition: FitDialog.cpp:1220
FitDialog::saveUserFunction
void saveUserFunction()
Definition: FitDialog.cpp:861
FitDialog::editBox
ScriptEdit * editBox
Definition: FitDialog.h:160
FitDialog::userFunctionNames
QStringList userFunctionNames()
Definition: FitDialog.cpp:1714
FitDialog::buttonPlugins
QPushButton * buttonPlugins
Definition: FitDialog.h:149
Graph
A 2D-plotting widget.
Definition: Graph.h:123
FitDialog::boxPoints
QSpinBox * boxPoints
Definition: FitDialog.h:158
FitDialog::showParametersTable
void showParametersTable()
Definition: FitDialog.cpp:782
FitDialog::d_result_curves
QList< QwtPlotCurve * > d_result_curves
Definition: FitDialog.h:137
FitDialog::initFitPage
void initFitPage()
Definition: FitDialog.cpp:122
FitDialog::boxWeighting
QComboBox * boxWeighting
Definition: FitDialog.h:169
ColorButton
A customized QtColorPicker used for color selection.
Definition: ColorButton.h:39
FitDialog::d_preview_curve
FunctionCurve * d_preview_curve
Definition: FitDialog.h:139
FitDialog::setNumPeaks
void setNumPeaks(int peaks)
Definition: FitDialog.cpp:1651
FitDialog::d_built_in_functions
QList< Fit * > d_built_in_functions
Definition: FitDialog.h:136
FitDialog::colNamesBox
QComboBox * colNamesBox
Definition: FitDialog.h:169
FitDialog::explainBox
QTextEdit * explainBox
Definition: FitDialog.h:161
FitDialog::boxFrom
DoubleSpinBox * boxFrom
Definition: FitDialog.h:155
FitDialog::d_graph
Graph * d_graph
Definition: FitDialog.h:134
FitDialog::showPredictionLimits
void showPredictionLimits()
Definition: FitDialog.cpp:1941
FitDialog::addFunction
void addFunction()
Definition: FitDialog.cpp:1325
FitDialog::updatePreviewColor
void updatePreviewColor(const QColor &)
Definition: FitDialog.cpp:1879
FitDialog::saveInitialGuesses
void saveInitialGuesses()
Definition: FitDialog.cpp:1722
FitDialog::btnAddFunc
QPushButton * btnAddFunc
Definition: FitDialog.h:166
FitDialog::showAdvancedPage
void showAdvancedPage()
Definition: FitDialog.cpp:1090
FitDialog::showCovarianceMatrix
void showCovarianceMatrix()
Definition: FitDialog.cpp:800
FitDialog::scaleErrorsBox
QCheckBox * scaleErrorsBox
Definition: FitDialog.h:175
FitDialog::boxConfidenceLevel
DoubleSpinBox * boxConfidenceLevel
Definition: FitDialog.h:173
FitDialog::showFitPage
void showFitPage()
Definition: FitDialog.cpp:970
FitDialog::btnConfidenceLimits
QPushButton * btnConfidenceLimits
Definition: FitDialog.h:172
FitDialog::lblFunction
QLabel * lblFunction
Definition: FitDialog.h:165
FitDialog::setFunction
void setFunction(bool ok)
Definition: FitDialog.cpp:1105
FitDialog::buttonCancel2
QPushButton * buttonCancel2
Definition: FitDialog.h:145
FitDialog::choosePluginsFolder
void choosePluginsFolder()
Definition: FitDialog.cpp:1192
FitDialog::boxPrecision
QSpinBox * boxPrecision
Definition: FitDialog.h:158
FitDialog::btnPredictionLimits
QPushButton * btnPredictionLimits
Definition: FitDialog.h:172
FitDialog::generatePointsBtn
QRadioButton * generatePointsBtn
Definition: FitDialog.h:170
FitDialog::btnDeleteFitCurves
QPushButton * btnDeleteFitCurves
Definition: FitDialog.h:167
FitDialog::removeUserFunction
void removeUserFunction()
Definition: FitDialog.cpp:939
FitDialog::showParseFunctions
void showParseFunctions()
Definition: FitDialog.cpp:1251
FitDialog::buttonOk
QPushButton * buttonOk
Definition: FitDialog.h:143
FitDialog::setSrcTables
void setSrcTables(QList< MdiSubWindow * > tables)
Definition: FitDialog.cpp:1531
FitDialog::guessParameters
void guessParameters()
Definition: FitDialog.cpp:1952
FitDialog::boxCurve
QComboBox * boxCurve
Definition: FitDialog.h:152
DoubleSpinBox
A QDoubleSpinBox allowing to customize numbers display with respect to locale settings.
Definition: DoubleSpinBox.h:39
FitDialog::boxParam
QLabel * boxParam
Definition: FitDialog.h:164
FitDialog::btnResiduals
QPushButton * btnResiduals
Definition: FitDialog.h:172
Fit
Fit base class.
Definition: Fit.h:44
FitDialog::selectSrcTable
void selectSrcTable(int tabnr)
Definition: FitDialog.cpp:1548
FitDialog::categoryBox
QListWidget * categoryBox
Definition: FitDialog.h:162
FitDialog::buttonEdit
QPushButton * buttonEdit
Definition: FitDialog.h:167
FitDialog::parseFormula
QString parseFormula(const QString &s)
Definition: FitDialog.cpp:1899
FitDialog::advancedPage
QWidget * advancedPage
Definition: FitDialog.h:159
FitDialog::buttonAdvanced
QPushButton * buttonAdvanced
Definition: FitDialog.h:147
ScriptEdit
Editor widget with support for evaluating expressions and executing code.
Definition: ScriptEdit.h:50
FitDialog::showFunctionsList
void showFunctionsList(int category)
Definition: FitDialog.cpp:1126
FitDialog::plugInNames
QStringList plugInNames()
Definition: FitDialog.cpp:1802
FitDialog::btnGuess
QPushButton * btnGuess
Definition: FitDialog.h:151
FitDialog::buttonClear
QPushButton * buttonClear
Definition: FitDialog.h:148
FitDialog::btnParamTable
QPushButton * btnParamTable
Definition: FitDialog.h:171
FitDialog::showEditPage
void showEditPage()
Definition: FitDialog.cpp:1085
FitDialog::enableApplyChanges
void enableApplyChanges(int=0)
Enable the "Apply" button.
Definition: FitDialog.cpp:1584
FunctionCurve
Definition: FunctionCurve.h:37
FitDialog::buttonCancel1
QPushButton * buttonCancel1
Definition: FitDialog.h:144
FitDialog::btnAddTxt
QPushButton * btnAddTxt
Definition: FitDialog.h:167
FitDialog::resetFunction
void resetFunction()
Clears the function editor, the parameter names and the function name.
Definition: FitDialog.cpp:1612
FitDialog::initBuiltInFunctions
void initBuiltInFunctions()
Definition: FitDialog.cpp:1619
FitDialog::logBox
QCheckBox * logBox
Definition: FitDialog.h:175
FitDialog::polynomOrderLabel
QLabel * polynomOrderLabel
Definition: FitDialog.h:165
FitDialog::editPage
QWidget * editPage
Definition: FitDialog.h:159
FitDialog::returnToFitPage
void returnToFitPage()
Definition: FitDialog.cpp:1810
FitDialog::btnLoadGuesses
QPushButton * btnLoadGuesses
Definition: FitDialog.h:151
FitDialog::enableWeightingParameters
void enableWeightingParameters(int index)
Definition: FitDialog.cpp:1559
Graph.h
FitDialog::accept
void accept()
Definition: FitDialog.cpp:1349
FitDialog::showParameterRange
void showParameterRange(bool)
Definition: FitDialog.cpp:1888
FitDialog::btnCovMatrix
QPushButton * btnCovMatrix
Definition: FitDialog.h:171
FitDialog::generatePointsBox
QSpinBox * generatePointsBox
Definition: FitDialog.h:158
FitDialog::setGraph
void setGraph(Graph *g)
Definition: FitDialog.cpp:829
FitDialog::btnContinue
QPushButton * btnContinue
Definition: FitDialog.h:166
FitDialog::previewBox
QCheckBox * previewBox
Definition: FitDialog.h:176
FitDialog::updatePreview
void updatePreview()
Definition: FitDialog.cpp:1826
FitDialog::btnBack
QPushButton * btnBack
Definition: FitDialog.h:150
FitDialog::paramTableName
QLineEdit * paramTableName
Definition: FitDialog.h:174
FitDialog::fitPage
QWidget * fitPage
Definition: FitDialog.h:159
FitDialog::d_current_fit
Fit * d_current_fit
Definition: FitDialog.h:133
FitDialog::buttonCancel3
QPushButton * buttonCancel3
Definition: FitDialog.h:146
FitDialog::d_param_table
QPointer< Table > d_param_table
Definition: FitDialog.h:135
FitDialog::builtInFunctionNames
QStringList builtInFunctionNames()
Definition: FitDialog.cpp:1661
FitDialog::srcTables
QList< MdiSubWindow * > srcTables
Definition: FitDialog.h:138
FitDialog::showResiduals
void showResiduals()
Definition: FitDialog.cpp:1919
FitDialog::loadUserFunctions
void loadUserFunctions()
Definition: FitDialog.cpp:1669
FitDialog::d_plugins
QList< Fit * > d_plugins
Definition: FitDialog.h:136
FitDialog::funcBox
QListWidget * funcBox
Definition: FitDialog.h:162
FitDialog::initEditPage
void initEditPage()
Definition: FitDialog.cpp:401
FitDialog::showConfidenceLimits
void showConfidenceLimits()
Definition: FitDialog.cpp:1930
MdiSubWindow
Base class of all MDI client windows.
Definition: MdiSubWindow.h:51
FitDialog::btnApply
QPushButton * btnApply
Definition: FitDialog.h:166
FitDialog::btnDelFunc
QPushButton * btnDelFunc
Definition: FitDialog.h:166
FitDialog::btnParamRange
QPushButton * btnParamRange
Definition: FitDialog.h:171
FitDialog::chooseFolder
void chooseFolder()
Definition: FitDialog.cpp:1184
FitDialog::modifyGuesses
void modifyGuesses(double *initVal)
Definition: FitDialog.cpp:1504
FitDialog::covMatrixName
QLineEdit * covMatrixName
Definition: FitDialog.h:174
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
FitDialog::tw
QStackedWidget * tw
Definition: FitDialog.h:142
FitDialog::chooseFitModelsFolder
void chooseFitModelsFolder()
Definition: FitDialog.cpp:1204
FitDialog::boxFunction
QTextEdit * boxFunction
Definition: FitDialog.h:161
FitDialog::plotLabelBox
QCheckBox * plotLabelBox
Definition: FitDialog.h:175
FitDialog::deleteFitCurves
void deleteFitCurves()
Deletes the result fit curves from the plot.
Definition: FitDialog.cpp:1589
FitDialog::boxParams
QTableWidget * boxParams
Definition: FitDialog.h:154
FitDialog::d_user_functions
QList< Fit * > d_user_functions
Definition: FitDialog.h:136
FitDialog::boxName
QLineEdit * boxName
Definition: FitDialog.h:163
FitDialog::globalParamTableBox
QCheckBox * globalParamTableBox
Definition: FitDialog.h:175
FitDialog::btnAddName
QPushButton * btnAddName
Definition: FitDialog.h:167
FitDialog::boxUseBuiltIn
QCheckBox * boxUseBuiltIn
Definition: FitDialog.h:141
FitDialog::btnSaveGuesses
QPushButton * btnSaveGuesses
Definition: FitDialog.h:151
FitDialog::lblPoints
QLabel * lblPoints
Definition: FitDialog.h:165
FitDialog::applyChanges
void applyChanges()
Applies the user changes to the numerical format of the output results.
Definition: FitDialog.cpp:758
FitDialog::FitDialog
FitDialog(Graph *g, QWidget *parent=0)
Definition: FitDialog.cpp:70
FitDialog::samePointsBtn
QRadioButton * samePointsBtn
Definition: FitDialog.h:170
FitDialog::boxErrorMsg
QLabel * boxErrorMsg
Definition: FitDialog.h:164
FitDialog::closeEvent
void closeEvent(QCloseEvent *e)
Definition: FitDialog.cpp:1567
FitDialog
Fit Wizard.
Definition: FitDialog.h:57
FitDialog::loadInitialGuesses
void loadInitialGuesses()
Definition: FitDialog.cpp:1765
FitDialog::boxTo
DoubleSpinBox * boxTo
Definition: FitDialog.h:156
FitDialog::tableNamesBox
QComboBox * tableNamesBox
Definition: FitDialog.h:169