1 // Copyright (C) 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
23 #include "pqPropertyWidget.h"
26 class pqTreeWidgetItemObject;
27 class QTreeWidgetItem;
31 class pqElectroRotationAbstractFieldsWidget : public pqPropertyWidget
33 typedef pqPropertyWidget Superclass;
37 // Property Qt used to set/get the fields with the property link
38 Q_PROPERTY(QList< QList< QVariant> > fields READ getFields WRITE setFields)
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)
44 pqElectroRotationAbstractFieldsWidget(
45 vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
46 virtual ~pqElectroRotationAbstractFieldsWidget();
49 // Corrected size hint, +3 pixel on each line
50 virtual QSize sizeHint() const;
54 // Signal emited when selected field changed
55 void fieldsChanged() const;
59 // bidrectionnal property link setter/getter
60 virtual QList< QList< QVariant> > getFields() const;
61 virtual void setFields(QList< QList< QVariant> > fields);
64 // Update the domain, eg: reload
65 virtual void setFieldsDomain(QList< QList< QVariant> > fields);
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);
74 // (Re)Load the tree widget items using recovered meta data graph
75 virtual void loadTreeWidgetItems() = 0;
79 pqTreeWidget* TreeWidget;
82 // Number of items, for graphic purpose
86 // Map of ItemPropertyName -> Item Pointer, contains only leaf.
87 QMap< QString, pqTreeWidgetItemObject*> ItemMap;
90 // Bug in qt, header->isVisible always return false, storing this info here
91 // https://bugreports.qt.io/browse/QTBUG-12939
95 // Slot called when the tree widget changed
96 virtual void onItemChanged(QTreeWidgetItem* itemOrig, int column) const;
99 Q_DISABLE_COPY(pqElectroRotationAbstractFieldsWidget);