File indexing completed on 2024-04-28 07:29:31

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 2006 David Saxton <david@bluehaze.org>
0005 
0006     This file is part of the KDE Project.
0007     KmPlot is part of the KDE-EDU Project.
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #ifndef _PARAMETERSWIDGET_H
0013 #define _PARAMETERSWIDGET_H
0014 
0015 #include <QGroupBox>
0016 #include <QList>
0017 
0018 #include "function.h"
0019 #include "ui_parameterswidget.h"
0020 
0021 class EquationEdit;
0022 
0023 class ParametersWidget : public QGroupBox, public Ui_ParametersWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit ParametersWidget(QWidget *parent);
0028 
0029     /**
0030      * Initializes the contents of the widgets to the settings in
0031      * \p function.
0032      */
0033     void init(const ParameterSettings &parameters);
0034     /**
0035      * \return the current settings as specified in the widgets.
0036      */
0037     ParameterSettings parameterSettings() const;
0038     /**
0039      * The ParametersWidget can make sure that when the user wants to use
0040      * a parameter (i.e. the Use List checkbox or Use Slider checkbox is
0041      * checked), the function string has a parameter variable. Use this
0042      * to add an EquationEdit for a function string that ParametersWidget
0043      * will update when necessary.
0044      */
0045     void associateEquationEdit(EquationEdit *edit);
0046 
0047 signals:
0048     /**
0049      * Emitted when the user edits the list of parameters.
0050      */
0051     void parameterListChanged();
0052 
0053 private slots:
0054     /**
0055      * Called when the "Edit [parameter] List" button is clicked.
0056      */
0057     void editParameterList();
0058     /**
0059      * Called when one of the checkboxes is checked.
0060      */
0061     void updateEquationEdits();
0062 
0063 protected:
0064     /**
0065      * If we are currently editing a cartesian function, this will be set
0066      * to its parameter list.
0067      */
0068     QList<Value> m_parameters;
0069     /**
0070      * The list of equation edits that may be updated. See sassociateEquationEdit.
0071      */
0072     QList<EquationEdit *> m_equationEdits;
0073 };
0074 
0075 #endif