X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetChoice.h;h=e8db6c289487d6942d47c8688fadc26c282b7e34;hb=450d1bd65c11870d3942a30164518037b9a7503e;hp=99bd281f9505ac5e8a1ee1e4663841551f6832f3;hpb=f1cd93fd02a54259f72e3191d037323a496b2bef;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h index 99bd281f9..e8db6c289 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.h +++ b/src/ModuleBase/ModuleBase_WidgetChoice.h @@ -13,42 +13,70 @@ class QWidget; class QLabel; class QComboBox; +class QButtonGroup; +/** +* \ingroup GUI +* Implementation of model widget for choice widget definition (combo box) +* It can be defined as following: +* \code +* +* \endcode +* Aditionally can be used: +* A key "widget_type". It can have values "combobox" or "radiobuttons". +* By default it uses "combobox". +* A key "buttons_dir" which is applicable only for "radiobuttons" mode. +* It defines direction of radiobuttons layout. it can be "vertical" or "horizontal" +* Default value is "vertical" +*/ class MODULEBASE_EXPORT ModuleBase_WidgetChoice : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \param theParent the parent object + /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetChoice(); - - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed - virtual bool storeValue() const; - virtual bool restoreValue(); + /// Defines if it is supported to set the value in this widget + /// It returns false because this is an info widget + virtual bool canSetValue() const { return false; }; virtual bool focusTo(); - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget - QWidget* getControl() const - { - return myContainer; - } - /// Returns list of widget controls - /// \return a control list + /// \return a controls list virtual QList getControls() const; +signals: + void itemSelected(int); + +protected: + /// Saves the internal parameters to the given feature + /// \return True in success + virtual bool storeValueCustom() const; + + virtual bool restoreValueCustom(); + private slots: + /// Slot called on combo box index change void onCurrentIndexChanged(int theIndex); private: - QWidget* myContainer; + /// The label QLabel* myLabel; + + /// The control QComboBox* myCombo; + QButtonGroup* myButtons; }; #endif