1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetEditor.h
4 // Created: 25 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #ifndef ModuleBase_WidgetEditor_H
8 #define ModuleBase_WidgetEditor_H
10 #include <ModuleBase.h>
11 #include "ModuleBase_WidgetDoubleValue.h"
14 #include <QStringList>
16 class ModelAPI_Feature;
20 /**\class ModuleBase_WidgetEditor
22 * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
24 class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue
29 /// \param theParent the parent object
30 /// \param theData the widget configuation. The attribute of the model widget is obtained from
31 ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData);
33 /// \param theParent the parent object
34 /// \param theAttribute The attribute of the model widget
35 ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
38 virtual ~ModuleBase_WidgetEditor();
40 /// Set focus to the first control of the current widget.
41 /// The focus policy of the control is checked.
42 /// If the widget has the NonFocus focus policy, it is skipped.
43 /// \return the state whether the widget can accept the focus
44 virtual bool focusTo();
46 /// Shous popup window under cursor for data editing
47 /// \param theSendSignals a flag whether the signals should be sent or the value
48 /// is to be applyed directly
49 /// \return true if the editor value is accepted
50 bool showPopupEditor(const bool theSendSignals = true);
52 /// Set current cursor position
53 /// \param theX the X coordinate
54 /// \param theY the Y coordinate
55 void setCursorPosition(const int theX, const int theY);
57 /// Returns true if the event is processed.
58 virtual bool processEnter();
62 /// \param theOutValue a result value
63 /// \param theOutText a result text
64 /// \return true if the editor value is accepted
65 bool editedValue(double& theOutValue, QString& theOutText);
68 ///< the current widget feature
71 ///< the kinds of possible features
72 QStringList myFeatureKinds;
74 int myXPosition, myYPosition;
76 QDialog* myEditorDialog;