]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_WidgetConcealedObjects.h
Salome HOME
Recover Eye button
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetConcealedObjects.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D\r
2 \r
3 // File:        ModuleBase_WidgetConcealedObjects.h\r
4 // Created:     29 Jul 2016\r
5 // Author:      Natalia ERMOLAEVA\r
6 \r
7 #ifndef MODULEBASE_WIDGETCONCEALEDOBJECTS_H_\r
8 #define MODULEBASE_WIDGETCONCEALEDOBJECTS_H_\r
9 \r
10 #include <ModuleBase.h>\r
11 #include <ModuleBase_ModelWidget.h>\r
12 \r
13 #include <string>\r
14 #include <map>\r
15 #include <memory>\r
16 \r
17 class ModelAPI_Object;\r
18 \r
19 class QWidget;\r
20 class QTableWidget;\r
21 class QToolButton;\r
22 \r
23 /**\r
24 * \ingroup GUI\r
25 * Implementation of model widget for table of concealed objects.\r
26 */\r
27 class MODULEBASE_EXPORT ModuleBase_WidgetConcealedObjects : public ModuleBase_ModelWidget\r
28 {\r
29   Q_OBJECT\r
30  public:\r
31   /// Constructor\r
32   /// \param theParent the parent object\r
33   /// \param theData the widget configuration.\r
34   ModuleBase_WidgetConcealedObjects(QWidget* theParent,\r
35                                     const Config_WidgetAPI* theData);\r
36   virtual ~ModuleBase_WidgetConcealedObjects();\r
37 \r
38   /// Redefinition of virtual method\r
39   virtual QList<QWidget*> getControls() const;\r
40 \r
41   /// The widget can not accept focus\r
42   virtual bool canAcceptFocus() const { return false; };\r
43 \r
44 protected:\r
45   /// Saves the internal parameters to the given feature\r
46   /// \return True in success\r
47   virtual bool storeValueCustom();\r
48 \r
49   /// Redefinition of virtual method\r
50   virtual bool restoreValueCustom();\r
51 \r
52 private:\r
53   /// Creates a row in view\r
54   /// \param theResult a result for the row\r
55   void addViewRow(const std::shared_ptr<ModelAPI_Result>& theResult);\r
56 \r
57 private slots:\r
58   /// Processes the display button click in the view.\r
59   /// \param theState a new state\r
60   void onItemToggled(bool theState);\r
61 \r
62 private:\r
63   /// Updates icon of button\r
64   /// \param theButton a button of the table\r
65   void updateItemIcon(QToolButton* theButton);\r
66 \r
67 private:\r
68   std::string myBaseShapeAttribute; ///< attribute of the base object\r
69   QTableWidget* myView; ///< table view of visibility states\r
70 \r
71   std::shared_ptr<ModelAPI_Feature> myBaseFeature; ///< backup of feature of filling the table view\r
72   /// backup of visualized in the view concealed objects, stored to avoid table rebuild by restore\r
73   std::map<int, std::shared_ptr<ModelAPI_Result> > myConcealedResults;\r
74 };\r
75 \r
76 #endif /* MODULEBASE_WIDGETCONCEALEDOBJECTS_H_ */\r