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

0001 /*
0002     File                 : LollipopPlotDock.h
0003     Project              : LabPlot
0004     Description          : Dock widget for the lollipop plot
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2023 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef LOLLIPOPPLOTDOCK_H
0011 #define LOLLIPOPPLOTDOCK_H
0012 
0013 #include "backend/worksheet/plots/cartesian/LollipopPlot.h"
0014 #include "kdefrontend/dockwidgets/BaseDock.h"
0015 #include "ui_lollipopplotdock.h"
0016 
0017 class AbstractAspect;
0018 class LineWidget;
0019 class SymbolWidget;
0020 class ValueWidget;
0021 class LollipopPlot;
0022 class TreeViewComboBox;
0023 class KConfig;
0024 
0025 class LollipopPlotDock : public BaseDock {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit LollipopPlotDock(QWidget*);
0030     void setPlots(QList<LollipopPlot*>);
0031     void updateLocale() override;
0032 
0033 private:
0034     Ui::LollipopPlotDock ui;
0035     LineWidget* lineWidget{nullptr};
0036     SymbolWidget* symbolWidget{nullptr};
0037     ValueWidget* valueWidget{nullptr};
0038     QList<LollipopPlot*> m_plots;
0039     LollipopPlot* m_plot{nullptr};
0040     TreeViewComboBox* cbXColumn{nullptr};
0041 
0042     QGridLayout* m_gridLayout;
0043     QPushButton* m_buttonNew;
0044     QVector<TreeViewComboBox*> m_dataComboBoxes;
0045     QVector<QPushButton*> m_removeButtons;
0046 
0047     void setModel();
0048     void load();
0049     void loadConfig(KConfig&);
0050     void setDataColumns() const;
0051     void loadDataColumns();
0052 
0053 private Q_SLOTS:
0054     // SLOTs for changes triggered in LollipopPlotDock
0055 
0056     //"General"-tab
0057     void xColumnChanged(const QModelIndex&);
0058     void removeXColumn();
0059     void addDataColumn();
0060     void removeDataColumn();
0061     void dataColumnChanged(const QModelIndex&);
0062     void orientationChanged(int);
0063 
0064     //"Line"-tab
0065     void currentBarLineChanged(int);
0066 
0067     //"Line"-tab
0068     void currentBarSymbolChanged(int);
0069 
0070     // SLOTs for changes triggered in Lollipop
0071     // general
0072     void plotXColumnChanged(const AbstractColumn*);
0073     void plotDataColumnsChanged(const QVector<const AbstractColumn*>&);
0074     void plotOrientationChanged(LollipopPlot::Orientation);
0075 
0076     // load and save
0077     void loadConfigFromTemplate(KConfig&);
0078     void saveConfigAsTemplate(KConfig&);
0079 
0080 Q_SIGNALS:
0081     void info(const QString&);
0082 };
0083 
0084 #endif