SHAPER  9.12.0
PartSet_BSplineWidget.h
1 // Copyright (C) 2019-2023 CEA, EDF
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 
20 #ifndef PartSet_BSplineWidget_H
21 #define PartSet_BSplineWidget_H
22 
23 
24 #include <PartSet.h>
25 
26 #include <ModelAPI_Feature.h>
27 
28 #include <ModuleBase_LabelValue.h>
29 #include <ModuleBase_ModelWidget.h>
30 #include <ModuleBase_ParamSpinBox.h>
31 
32 class QGroupBox;
33 class QScrollArea;
34 class QToolButton;
35 
40 {
41 Q_OBJECT
42 public:
46  PartSet_BSplineWidget(QWidget* theParent,
47  const Config_WidgetAPI* theData);
48 
49  virtual ~PartSet_BSplineWidget() {}
50 
52  virtual void deactivate();
53 
56  virtual QList<QWidget*> getControls() const;
57 
62  virtual void setFeature(const FeaturePtr& theFeature, const bool theToStoreValue = false,
63  const bool isUpdateFlushed = true);
64 
65 protected:
68  virtual bool storeValueCustom();
69 
71  virtual bool restoreValueCustom();
72 
74  void addPoleWidget();
75 
77  void storePolesAndWeights() const;
78 
79 private slots:
80  void onAddPole();
81 
82 private:
83  struct BSplinePoleWidgets {
86  ModuleBase_ParamSpinBox* myWeight;
87  QToolButton* myAddBtn;
88  };
89 
90  QGroupBox* createPoleWidget(BSplinePoleWidgets& thePole,
91  const QString& theName,
92  QWidget* theParent);
93 
94  QWidget* myPolesWgt;
95  QGroupBox* myPolesGroupBox;
96  QScrollArea* myScrollArea;
97  std::list<BSplinePoleWidgets> myPoles;
98 };
99 
100 #endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Implementation of model widget for a label control.
Definition: ModuleBase_LabelValue.h:34
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
An extension of a double spin box which let to use parameters and expressions for value definition.
Definition: ModuleBase_ParamSpinBox.h:37
Represent a content of the property panel to show/modify parameters of B-spline curve.
Definition: PartSet_BSplineWidget.h:40
virtual QList< QWidget * > getControls() const
Returns list of widget controls.
Definition: PartSet_BSplineWidget.cpp:94
virtual bool restoreValueCustom()
Restore value from attribute data to the widget's control.
Definition: PartSet_BSplineWidget.cpp:132
virtual void deactivate()
The methiod called when widget is deactivated.
Definition: PartSet_BSplineWidget.cpp:87
void addPoleWidget()
Create group of widgets related to coordinates of pole and its weight.
Definition: PartSet_BSplineWidget.cpp:159
PartSet_BSplineWidget(QWidget *theParent, const Config_WidgetAPI *theData)
Constructor.
Definition: PartSet_BSplineWidget.cpp:42
virtual bool storeValueCustom()
Saves the internal parameters to the given feature.
Definition: PartSet_BSplineWidget.cpp:115
virtual void setFeature(const FeaturePtr &theFeature, const bool theToStoreValue=false, const bool isUpdateFlushed=true)
Set feature which is processing by active operation.
Definition: PartSet_BSplineWidget.cpp:79
void storePolesAndWeights() const
Update attributes of B-spline feature.
Definition: PartSet_BSplineWidget.cpp:101