File indexing completed on 2025-01-26 03:34:11

0001 /*
0002     File                 : ErrorBar.h
0003     Project              : LabPlot
0004     Description          : ErrorBar
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2024 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef ERRORBAR_H
0011 #define ERRORBAR_H
0012 
0013 #include "backend/core/AbstractAspect.h"
0014 #include "backend/lib/macros.h"
0015 
0016 class AbstractColumn;
0017 class ErrorBarPrivate;
0018 class KConfigGroup;
0019 
0020 class ErrorBar : public AbstractAspect {
0021     Q_OBJECT
0022 
0023 public:
0024     friend class ErrorBarSetPlusColumnCmd;
0025     friend class ErrorBarSetMinusColumnCmd;
0026     enum class Type { NoError, Symmetric, Asymmetric, Poisson };
0027     enum class BarsType { Simple, WithEnds };
0028 
0029     explicit ErrorBar(const QString& name);
0030     ~ErrorBar() override;
0031 
0032     void save(QXmlStreamWriter*) const override;
0033     bool load(XmlStreamReader*, bool preview) override;
0034 
0035     void setPrefix(const QString&);
0036     const QString& prefix() const;
0037     void init(const KConfigGroup&);
0038     void update();
0039 
0040     BASIC_D_ACCESSOR_DECL(Type, type, Type)
0041     POINTER_D_ACCESSOR_DECL(const AbstractColumn, plusColumn, PlusColumn)
0042     POINTER_D_ACCESSOR_DECL(const AbstractColumn, minusColumn, MinusColumn)
0043     CLASS_D_ACCESSOR_DECL(QString, plusColumnPath, PlusColumnPath)
0044     CLASS_D_ACCESSOR_DECL(QString, minusColumnPath, MinusColumnPath)
0045 
0046     typedef ErrorBarPrivate Private;
0047 
0048 protected:
0049     ErrorBarPrivate* const d_ptr;
0050 
0051 private:
0052     Q_DECLARE_PRIVATE(ErrorBar)
0053     void connectPlusColumn(const AbstractColumn*);
0054     void connectMinusColumn(const AbstractColumn*);
0055 
0056 private Q_SLOTS:
0057     void plusColumnAboutToBeRemoved(const AbstractAspect*);
0058     void minusColumnAboutToBeRemoved(const AbstractAspect*);
0059 
0060 Q_SIGNALS:
0061     void updateRequested();
0062 
0063     void typeChanged(ErrorBar::Type);
0064     void plusDataChanged();
0065     void plusColumnChanged(const AbstractColumn*);
0066     void minusDataChanged();
0067     void minusColumnChanged(const AbstractColumn*);
0068 };
0069 
0070 #endif