File indexing completed on 2025-01-05 03:35:26

0001 /*
0002     File                 : BoxPlotDock.h
0003     Project              : LabPlot
0004     Description          : Dock widget for the box plot
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2021-2023 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef BOXPLOTDOCK_H
0011 #define BOXPLOTDOCK_H
0012 
0013 #include "backend/worksheet/plots/cartesian/BoxPlot.h"
0014 #include "kdefrontend/dockwidgets/BaseDock.h"
0015 #include "ui_boxplotdock.h"
0016 
0017 class AspectTreeModel;
0018 class BoxPlot;
0019 class BackgroundWidget;
0020 class LineWidget;
0021 class SymbolWidget;
0022 class TreeViewComboBox;
0023 class QPushButton;
0024 class KConfig;
0025 
0026 class BoxPlotDock : public BaseDock {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit BoxPlotDock(QWidget*);
0031     void setBoxPlots(QList<BoxPlot*>);
0032     void updateLocale() override;
0033 
0034 private:
0035     Ui::BoxPlotDock ui;
0036     BackgroundWidget* backgroundWidget{nullptr};
0037     SymbolWidget* symbolWidget{nullptr};
0038     LineWidget* borderLineWidget{nullptr};
0039     LineWidget* medianLineWidget{nullptr};
0040     LineWidget* whiskersLineWidget{nullptr};
0041     LineWidget* whiskersCapLineWidget{nullptr};
0042 
0043     QList<BoxPlot*> m_boxPlots;
0044     BoxPlot* m_boxPlot{nullptr};
0045 
0046     QGridLayout* m_gridLayout;
0047     QPushButton* m_buttonNew;
0048     QVector<TreeViewComboBox*> m_dataComboBoxes;
0049     QVector<QPushButton*> m_removeButtons;
0050 
0051     void load();
0052     void loadConfig(KConfig&);
0053     void setModel();
0054     void setDataColumns() const;
0055     void loadDataColumns();
0056     void updateSymbolWidgets();
0057 
0058 private Q_SLOTS:
0059     // SLOTs for changes triggered in BoxPlotDock
0060 
0061     //"General"-tab
0062     void addDataColumn();
0063     void removeDataColumn();
0064     void dataColumnChanged(const QModelIndex&);
0065     void orderingChanged(int);
0066     void orientationChanged(int);
0067     void variableWidthChanged(bool);
0068     void notchesEnabledChanged(bool);
0069 
0070     //"Box"-tab
0071     void currentBoxChanged(int);
0072     void widthFactorChanged(int);
0073 
0074     // symbols
0075     void symbolCategoryChanged();
0076     void jitteringEnabledChanged(bool);
0077 
0078     // whiskers
0079     void whiskersTypeChanged(int);
0080     void whiskersRangeParameterChanged(const QString&);
0081     void whiskersCapSizeChanged(double) const;
0082 
0083     //"Margin Plots"-Tab
0084     void rugEnabledChanged(bool);
0085     void rugLengthChanged(double) const;
0086     void rugWidthChanged(double) const;
0087     void rugOffsetChanged(double) const;
0088 
0089     // SLOTs for changes triggered in BoxPlot
0090     // general
0091     void plotDescriptionChanged(const AbstractAspect*);
0092     void plotDataColumnsChanged(const QVector<const AbstractColumn*>&);
0093     void plotOrderingChanged(BoxPlot::Ordering);
0094     void plotOrientationChanged(BoxPlot::Orientation);
0095     void plotVariableWidthChanged(bool);
0096     void plotWidthFactorChanged(double);
0097     void plotNotchesEnabledChanged(bool);
0098 
0099     // symbols
0100     void plotJitteringEnabledChanged(bool);
0101 
0102     // whiskers
0103     void plotWhiskersTypeChanged(BoxPlot::WhiskersType);
0104     void plotWhiskersRangeParameterChanged(double);
0105     void plotWhiskersCapSizeChanged(double);
0106 
0107     //"Margin Plots"-Tab
0108     void plotRugEnabledChanged(bool);
0109     void plotRugLengthChanged(double);
0110     void plotRugWidthChanged(double);
0111     void plotRugOffsetChanged(double);
0112 
0113     // load and save
0114     void loadConfigFromTemplate(KConfig&);
0115     void saveConfigAsTemplate(KConfig&);
0116 
0117 Q_SIGNALS:
0118     void info(const QString&);
0119 };
0120 
0121 #endif