Salome HOME
Copyright update: 2016
[modules/paravis.git] / src / Plugins / ArrayRenamer / pqArraysEditorPropertyWidget.h
1 // Copyright (C) 2014-2016  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
45              READ arraysInfo
46              WRITE setArraysInfo
47              NOTIFY arraysInfoChanged)
48
49   Q_PROPERTY(QList<QVariant> componentsInfo
50              READ componentsInfo
51              WRITE setComponentsInfo
52              NOTIFY componentsInfoChanged)
53
54
55   typedef pqPropertyWidget Superclass;
56  public:
57   pqArraysEditorPropertyWidget(vtkSMProxy* proxy, vtkSMPropertyGroup* smgroup, QWidget* parent=0);
58   virtual ~pqArraysEditorPropertyWidget();
59
60   /// Get/Set the arrays Info
61   QList<QVariant> arraysInfo() const;
62   void setArraysInfo(const QList<QVariant>&);
63
64   /// Get/Set the arrays Info
65   QList<QVariant> componentsInfo() const;
66   void setComponentsInfo(const QList<QVariant>&);
67
68
69  signals:
70   /// Fired when the arrays Info is changes.
71   void arraysInfoChanged();
72   void componentsInfoChanged();
73
74 private slots:
75   /// called whenever the internal model's data changes.
76   void onDataChanged(const QModelIndex& topleft, const QModelIndex& btmright);
77   void onComponentsEdit();
78
79   /// called whenever the input changed.
80   void onInputDataChanged();
81
82  private: // Methods
83   void updateArraysList();
84
85  private: // Fields
86
87   vtkSmartPointer<vtkSMPropertyGroup> myPropertyGroup;
88   vtkEventQtSlotConnect* myConnection;
89   unsigned long myDataTime;
90   
91   //Array's table
92   pqArraysModel* myArraysModel;
93   QTableView*    myArraysTable;
94 }; 
95
96 #endif // __pqArraysEditorPropertyWidget_h