Tulip  5.7.4
Large graphs analysis and drawing
ParameterListModel.h
1 /*
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef PARAMETERLISTMODEL_H
22 #define PARAMETERLISTMODEL_H
23 
24 #include <QTableView>
25 #include <vector>
26 
27 #include <tulip/TulipModel.h>
28 #include <tulip/WithParameter.h>
29 #include <tulip/DataSet.h>
30 
31 namespace tlp {
32 
33 class TLP_QT_SCOPE ParameterListModel : public TulipModel {
34  std::vector<ParameterDescription> _params;
35  tlp::DataSet _data;
36  tlp::Graph *_graph;
37  bool _showIcons, _darkBackground;
38 
39 public:
40  explicit ParameterListModel(const tlp::ParameterDescriptionList &params,
41  tlp::Graph *graph = nullptr, QObject *parent = nullptr,
42  bool showIcons = false, bool darkBackground = false);
43 
44  static ParameterListModel *configureTableView(QTableView *table,
45  const tlp::ParameterDescriptionList &params,
46  tlp::Graph *graph = nullptr,
47  QObject *parent = nullptr, bool showIcons = false);
48 
49  tlp::DataSet parametersValues() const;
50  void setParametersValues(const tlp::DataSet &data);
51 
52  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
53  QModelIndex parent(const QModelIndex &child) const override;
54  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
55  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
56  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
58  Qt::ItemFlags flags(const QModelIndex &index) const override;
59  bool setData(const QModelIndex &index, const QVariant &value, int role) override;
60  QString getParameterName(int section);
61  QString getParameterHelp(int section);
62  bool isMandatory(int section);
63  int parameterColumnMinWidth();
64 };
65 } // namespace tlp
66 
67 #endif // PARAMETERLISTMODEL_H
68 ///@endcond
A container that can store data from any type.
Definition: DataSet.h:195