]> SALOME platform Git repositories - tools/paravisaddons_common.git/blob - src/ElectromagnetismRotation/plugin/ParaViewPlugin/pqElectroRotationAbstractFieldsWidget.h
Salome HOME
initial commit from paravisaddons
[tools/paravisaddons_common.git] / src / ElectromagnetismRotation / plugin / ParaViewPlugin / pqElectroRotationAbstractFieldsWidget.h
1 // Copyright (C) 2021  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 : Anthony Geay
20
21 #pragma once
22
23 #include "pqPropertyWidget.h"
24
25 class pqTreeWidget;
26 class pqTreeWidgetItemObject;
27 class QTreeWidgetItem;
28 class vtkSMProxy;
29 class vtkSMProperty;
30
31 class pqElectroRotationAbstractFieldsWidget : public pqPropertyWidget
32 {
33   typedef pqPropertyWidget Superclass;
34   Q_OBJECT
35
36   // Description
37   // Property Qt used to set/get the fields with the property link
38   Q_PROPERTY(QList< QList< QVariant> > fields READ getFields WRITE setFields)
39
40   // Description
41   // Property Qt used to set the gorup fields domain with the property link
42   Q_PROPERTY(QList< QList< QVariant> > fieldsDomain READ getFields WRITE setFieldsDomain)
43 public:
44   pqElectroRotationAbstractFieldsWidget(
45     vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
46   virtual ~pqElectroRotationAbstractFieldsWidget();
47
48   // Description
49   // Corrected size hint, +3 pixel on each line
50   virtual QSize sizeHint() const;
51
52 signals:
53   // Description
54   // Signal emited when selected field changed
55   void fieldsChanged() const;
56
57 protected:
58   // Description
59   // bidrectionnal property link setter/getter
60   virtual QList< QList< QVariant> > getFields() const;
61   virtual void setFields(QList< QList< QVariant> > fields);
62
63   // Description
64   // Update the domain, eg: reload
65   virtual void setFieldsDomain(QList< QList< QVariant> > fields);
66
67
68   // Description
69   // Initialize the widget items and connect it to property
70   // To be called by subclasses in constructor
71   virtual void initializeTreeWidget(vtkSMProxy *smproxy, vtkSMProperty *smproperty);
72
73   // Description
74   // (Re)Load the tree widget items using recovered meta data graph
75   virtual void loadTreeWidgetItems() = 0;
76
77   // Description
78   // Tree widget
79   pqTreeWidget* TreeWidget;
80
81   // Description
82   // Number of items, for graphic purpose
83   int NItems;
84
85   // Description
86   // Map of ItemPropertyName -> Item Pointer, contains only leaf.
87   QMap< QString, pqTreeWidgetItemObject*> ItemMap;
88
89   // Description
90   // Bug in qt, header->isVisible always return false, storing this info here
91   // https://bugreports.qt.io/browse/QTBUG-12939
92   bool visibleHeader;
93 protected slots:
94   // Description
95   // Slot called when the tree widget changed
96   virtual void onItemChanged(QTreeWidgetItem* itemOrig, int column) const;
97
98 private:
99   Q_DISABLE_COPY(pqElectroRotationAbstractFieldsWidget);
100 };