SHAPER  9.12.0
ModuleBase_WidgetEditor.h
1 // Copyright (C) 2014-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 ModuleBase_WidgetEditor_H
21 #define ModuleBase_WidgetEditor_H
22 
23 #include <ModuleBase.h>
24 #include "ModuleBase_WidgetDoubleValue.h"
25 
26 #include <QObject>
27 #include <QStringList>
28 
29 class ModelAPI_Feature;
30 class QDialog;
31 class QLineEdit;
32 
37 class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue
38 {
39 Q_OBJECT
40  public:
44  ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData);
48  ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
49 
51  virtual ~ModuleBase_WidgetEditor();
52 
57  virtual bool focusTo();
58 
63  bool showPopupEditor(const bool theSendSignals = true);
64 
68  void setCursorPosition(const int theX, const int theY);
69 
70 protected:
72  virtual bool processEnter();
73 
75  virtual bool processEscape();
76 
77 private:
84  bool editedValue(double theSpinMinValue, double theSpinMaxValue,
85  double& theOutValue, QString& theOutText);
86 
87  private:
89  FeaturePtr myFeature;
90 
92  QStringList myFeatureKinds;
93 
94  int myXPosition, myYPosition;
95 
96  QDialog* myEditorDialog;
97 };
98 
99 #endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
FeaturePtr myFeature
A feature which is processing by active operation.
Definition: ModuleBase_ModelWidget.h:439
virtual bool focusTo()
Set focus to the first control of the current widget.
Definition: ModuleBase_ModelWidget.cpp:267
A class of property panel widget for double value input It can be defined with "doublevalue" keyword.
Definition: ModuleBase_WidgetDoubleValue.h:41
virtual bool processEnter()
Returns true if the event is processed.
Definition: ModuleBase_WidgetDoubleValue.cpp:224
Custom widget.
Definition: ModuleBase_WidgetEditor.h:38
ModuleBase_WidgetEditor(QWidget *theParent, const std::string &theAttribute)
Constructor.