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;
19 /**\class ModuleBase_WidgetEditor
21 * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
23 class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue
28 /// \param theParent the parent object
29 /// \param theData the widget configuation. The attribute of the model widget is obtained from
30 ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData);
32 /// \param theParent the parent object
33 /// \param theAttribute The attribute of the model widget
34 ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
37 virtual ~ModuleBase_WidgetEditor();
39 /// Set focus to the first control of the current widget. The focus policy of the control is checked.
40 /// If the widget has the NonFocus focus policy, it is skipped.
41 /// \return the state whether the widget can accept the focus
42 virtual bool focusTo();
44 /// Shous popup window under cursor for data editing
45 /// \param theSendSignals a flag whether the signals should be sent or the value
46 /// is to be applyed directly
47 /// \return true if the editor value is accepted
48 bool showPopupEditor(const bool theSendSignals = true);
50 /// Set current cursor position
51 /// \param theX the X coordinate
52 /// \param theY the Y coordinate
53 void setCursorPosition(const int theX, const int theY);
57 /// \param theOutValue a result value
58 /// \param theOutText a result text
59 /// \return true if the editor value is accepted
60 bool editedValue(double& theOutValue, QString& theOutText);
63 ///< the current widget feature
66 ///< the kinds of possible features
67 QStringList myFeatureKinds;
69 int myXPosition, myYPosition;