1 // Copyright (C) 2010-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay
21 #ifndef __pqAbstractFieldsWidget_h
22 #define __pqAbstractFieldsWidget_h
24 #include "pqPropertyWidget.h"
27 class pqTreeWidgetItemObject;
28 class QTreeWidgetItem;
32 class pqAbstractFieldsWidget : public pqPropertyWidget
34 typedef pqPropertyWidget Superclass;
38 // Property Qt used to set/get the fields with the property link
39 Q_PROPERTY(QList< QList< QVariant> > fields READ getFields WRITE setFields)
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)
45 pqAbstractFieldsWidget(
46 vtkSMProxy *smproxy, vtkSMProperty * smproperty, QWidget *parentObject = 0);
47 virtual ~pqAbstractFieldsWidget();
50 // Corrected size hint, +3 pixel on each line
51 virtual QSize sizeHint() const;
55 // Signal emited when selected field changed
56 void fieldsChanged() const;
60 // bidrectionnal property link setter/getter
61 virtual QList< QList< QVariant> > getFields() const;
62 virtual void setFields(QList< QList< QVariant> > fields);
65 // Update the domain, eg: reload
66 virtual void setFieldsDomain(QList< QList< QVariant> > fields);
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);
75 // (Re)Load the tree widget items using recovered meta data graph
76 virtual void loadTreeWidgetItems() = 0;
80 pqTreeWidget* TreeWidget;
83 // Number of items, for graphic purpose
87 // Map of ItemPropertyName -> Item Pointer, contains only leaf.
88 QMap< QString, pqTreeWidgetItemObject*> ItemMap;
91 // Bug in qt, header->isVisible always return false, storing this info here
92 // https://bugreports.qt.io/browse/QTBUG-12939
96 // Slot called when the tree widget changed
97 virtual void onItemChanged(QTreeWidgetItem* itemOrig, int column) const;
100 Q_DISABLE_COPY(pqAbstractFieldsWidget)