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