Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Plugins / ArrayRenamer / plugin / pqArraysEditorPropertyWidget.h
1 // Copyright (C) 2014-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Roman NIKOLAEV
20
21 /*========================================================================*/
22 #ifndef __pqArraysEditorPropertyWidget_h
23 #define __pqArraysEditorPropertyWidget_h
24
25 #include <pqPropertyWidget.h>
26 #include <vtkSmartPointer.h>
27
28 // ParaView classes
29 class vtkSMPropertyGroup;
30 class vtkEventQtSlotConnect;
31
32 // Qt Classes
33 class QTableView;
34 class QModelIndex;
35
36 class pqArraysModel;
37
38 /// pqArraysEditorPropertyWidget is the pqPropertyWidget used to edit
39 /// arrays and array's components.
40 class VTK_EXPORT pqArraysEditorPropertyWidget : public pqPropertyWidget
41 {
42   Q_OBJECT
43
44   Q_PROPERTY(QList<QVariant> arrayInfo READ arraysInfo WRITE setArraysInfo NOTIFY arraysInfoChanged)
45
46   Q_PROPERTY(QList<QVariant> componentsInfo READ componentsInfo WRITE setComponentsInfo NOTIFY
47       componentsInfoChanged)
48
49   typedef pqPropertyWidget Superclass;
50
51 public:
52   pqArraysEditorPropertyWidget(vtkSMProxy* proxy, vtkSMPropertyGroup* smgroup, QWidget* parent = nullptr);
53   virtual ~pqArraysEditorPropertyWidget();
54
55   /// Get/Set the arrays Info
56   QList<QVariant> arraysInfo() const;
57   void setArraysInfo(const QList<QVariant>&);
58
59   /// Get/Set the arrays Info
60   QList<QVariant> componentsInfo() const;
61   void setComponentsInfo(const QList<QVariant>&);
62
63 signals:
64   /// Fired when the arrays Info is changes.
65   void arraysInfoChanged();
66   void componentsInfoChanged();
67
68 private slots:
69   /// called whenever the internal model's data changes.
70   void onDataChanged(const QModelIndex& topleft, const QModelIndex& btmright);
71   void onComponentsEdit();
72
73   /// called whenever the input changed.
74   void onInputDataChanged();
75
76 private: // Methods
77   void updateArraysList();
78
79 private: // Fields
80   vtkSmartPointer<vtkSMPropertyGroup> myPropertyGroup;
81   vtkEventQtSlotConnect* myConnection;
82   unsigned long myDataTime;
83
84   // Array's table
85   pqArraysModel* myArraysModel;
86   QTableView* myArraysTable;
87 };
88
89 #endif // __pqArraysEditorPropertyWidget_h