File indexing completed on 2025-07-13 03:32:38

0001 /*
0002     File                 : ROOTOptionsWidget.h
0003     Project              : LabPlot
0004     Description          : widget providing options for the import of ROOT data
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2018 Christoph Roick <chrisito@gmx.de>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef ROOTOPTIONSWIDGET_H
0012 #define ROOTOPTIONSWIDGET_H
0013 
0014 #include "ui_rootoptionswidget.h"
0015 
0016 class ImportFileWidget;
0017 class ROOTFilter;
0018 
0019 /// Widget providing options for the import of ROOT data
0020 class ROOTOptionsWidget : public QWidget {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit ROOTOptionsWidget(QWidget*, ImportFileWidget*);
0025     void clear();
0026     /// Fill the list of available histograms
0027     void updateContent(ROOTFilter* filter, const QString& fileName);
0028     /// Return a list of selected histograms
0029     const QStringList selectedNames() const;
0030     int lines() const {
0031         return ui.sbPreviewLines->value();
0032     }
0033     int startRow() const {
0034         return ui.sbFirst->value();
0035     }
0036     int endRow() const {
0037         return ui.sbLast->value();
0038     }
0039     QVector<QStringList> columns() const;
0040     void setNRows(int nrows);
0041     QTableWidget* previewWidget() const {
0042         return ui.twPreview;
0043     }
0044 
0045 private:
0046     Ui::ROOTOptionsWidget ui;
0047     QTreeWidgetItem* histItem;
0048     QTreeWidgetItem* treeItem;
0049     QMultiHash<QStringList, QVector<QStringList>> leaves;
0050 
0051     ImportFileWidget* m_fileWidget;
0052     bool histselected = false;
0053 
0054 private Q_SLOTS:
0055     /// Updates the selected data set of a ROOT file when a new item is selected
0056     void rootObjectSelectionChanged();
0057 };
0058 
0059 #endif