SHAPER 9.16.0
PartSet_WidgetSketchCreator.h
1// Copyright (C) 2014-2026 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_WidgetSketchCreator_H
21#define PartSet_WidgetSketchCreator_H
22
23#include "PartSet.h"
24
25#include <ModuleBase_WidgetSelector.h>
26
27class QLabel;
28class QLineEdit;
29class PartSet_Module;
34
43{
44Q_OBJECT
45
46public:
52 const Config_WidgetAPI* theData);
53
55
58 virtual QList<QWidget*> getControls() const;
59
64 virtual bool focusTo();
65
67 virtual void deactivate();
68
73 virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
74 const bool theToValidate);
75
77 virtual void setEditingMode(bool isEditing);
78
85 virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
86
88 virtual bool isInformative() const { return false; }
89
90protected:
93 void openExtrusionTransaction();
94
98 virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
99
102 virtual bool storeValueCustom();
103
104 virtual bool restoreValueCustom();
105
109 virtual AttributePtr attribute() const;
110
113 void activateSelectionControl();
114
117 void setVisibleSelectionControl(const bool theSelectionControl);
118
121 virtual QIntList shapeTypes() const;
122
125 void updateOnSelectionChanged(const bool theDone);
126
127protected:
129 virtual bool processSelection();
130
131private:
135 bool isSelectionMode() const;
136
139 bool hasSubObjects() const;
140
141private slots:
142 void onResumed(ModuleBase_Operation* theOp);
143
145 void onSelectionTypeChanged();
146
147private:
151 bool startSketchOperation(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
152
154 static void setSketchObjectToList(const CompositeFeaturePtr& theFeature,
155 const AttributePtr& theAttribute);
156
159 bool validateSelectionList() const;
160
164 void setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget,
165 const bool theEnabled);
166
167private:
168 std::string myAttributeListID;
169
170 PartSet_Module* myModule;
171
174 bool myIsCustomAttribute;
175
176 QWidget* mySizeOfViewWidget;
177 QLineEdit* mySizeOfView;
179 QLabel* myLabel;
180
182 QStringList myShapeTypes;
183
185 PartSet_PreviewPlanes* myPreviewPlanes;
186
187 bool myIsUseChoice;
188
190 ModuleBase_ChoiceCtrl* myTypeCtrl;
191 std::string myDefMode;
192};
193
194#endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
A Choice control.
Definition: ModuleBase_ChoiceCtrl.h:42
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
virtual void setEditingMode(bool isEditing)
Editing mode depends on mode of current operation. This value is defined by it.
Definition: ModuleBase_ModelWidget.h:273
virtual QList< QWidget * > getControls() const =0
Returns list of widget controls.
virtual bool storeValueCustom()=0
Saves the internal parameters to the given feature.
virtual bool restoreValueCustom()=0
Restore value from attribute data to the widget's control.
virtual bool setSelection(QList< std::shared_ptr< ModuleBase_ViewerPrs > > &theValues, const bool theToValidate)
Set the given wrapped value to the current widget This value should be processed in the widget accord...
Definition: ModuleBase_ModelWidget.h:163
virtual bool focusTo()
Set focus to the first control of the current widget.
Definition: ModuleBase_ModelWidget.cpp:267
Base class for all operations.
Definition: ModuleBase_Operation.h:53
Implementation of widget for selection.
Definition: ModuleBase_WidgetSelector.h:43
virtual bool isValidSelectionCustom(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)
Checks the widget validity.
Definition: ModuleBase_WidgetSelector.cpp:224
virtual QIntList shapeTypes() const =0
Returns a list of possible shape types.
virtual bool processSelection()
Returns true if envent is processed. The default implementation is empty, returns false.
Definition: ModuleBase_WidgetSelector.cpp:88
virtual void updateOnSelectionChanged(const bool theDone)
Emits model changed info, updates the current control by selection change.
Definition: ModuleBase_WidgetSelector.cpp:102
virtual void deactivate()
The methiod called when widget is deactivated.
Definition: ModuleBase_WidgetSelector.cpp:254
virtual bool isValidSelection(const std::shared_ptr< ModuleBase_ViewerPrs > &theValue)
Checks all widget validator if the owner is valid.
Definition: ModuleBase_WidgetValidated.cpp:256
virtual AttributePtr attribute() const
Returns attribute, which should be validated.
Definition: ModuleBase_WidgetValidated.cpp:250
Implementation of Partset module.
Definition: PartSet_Module.h:69
A class to show/hide sketch preview planes.
Definition: PartSet_PreviewPlanes.h:37
A widget which allow creation of a sketch in another operation.
Definition: PartSet_WidgetSketchCreator.h:43
virtual bool isInformative() const
Returns True in case if the widget contains useful information for inspection tool.
Definition: PartSet_WidgetSketchCreator.h:88