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

0001 /*
0002     File                 : FlattenColumnsDialog.h
0003     Project              : LabPlot
0004     Description          : Dialog for flattening of spreadsheet columns
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2022 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef FLATTENCOLUMNSDIALOG_H
0011 #define FLATTENCOLUMNSDIALOG_H
0012 
0013 #include "ui_flattencolumnswidget.h"
0014 #include <QDialog>
0015 
0016 class Column;
0017 class Spreadsheet;
0018 class QComboBox;
0019 
0020 class FlattenColumnsDialog : public QDialog {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit FlattenColumnsDialog(Spreadsheet* s, QWidget* parent = nullptr);
0025     ~FlattenColumnsDialog() override;
0026     void setColumns(const QVector<Column*>&);
0027     void flatten(const Spreadsheet* source, const QVector<Column*>& valuesColumns, const QVector<Column*>& referenceColumns) const;
0028 
0029 private:
0030     Ui::FlattenColumnsWidget ui;
0031     Spreadsheet* m_spreadsheet;
0032     QVector<Column*> m_columns;
0033     QStringList m_referenceColumnNames;
0034 
0035     // widgets to handle the reference columns
0036     QPushButton* m_okButton;
0037     QGridLayout* m_gridLayout;
0038     QPushButton* m_buttonNew;
0039     QVector<QComboBox*> m_columnComboBoxes;
0040     QVector<QPushButton*> m_removeButtons;
0041 
0042 private Q_SLOTS:
0043     void flattenColumns() const;
0044     void addReferenceColumn();
0045     void removeReferenceColumn();
0046 };
0047 
0048 #endif