Computer Assited Medical Intervention Tool Kit  version 5.0
ActionViewer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef ACTIONVIEWER_H
27 #define ACTIONVIEWER_H
28 
29 #include "ActionViewerAPI.h"
30 
31 #include <Viewer.h>
32 #include <Action.h>
33 #include <Component.h>
34 
35 #include <QWidget>
36 #include <QComboBox>
37 #include <QLabel>
38 #include <QVBoxLayout>
39 #include <QPushButton>
40 #include <QStackedWidget>
41 #include <QCompleter>
42 #include <QLineEdit>
43 
64  Q_OBJECT
65 
66 public:
71  Q_INVOKABLE ActionViewer(QString name);
72 
74  virtual ~ActionViewer();
75 
77 
78  virtual void refresh(Viewer* whoIsAsking = nullptr) override;
80 
82  virtual QWidget* getWidget() override;
84 
86  virtual void setSearchPanelVisible(bool);
88 
89 protected slots :
91  void changeName();
92 
94  void changeFamily();
95 
97  void changeTag();
98 
99 private:
101  enum UpdateReason {ActionFamilyChanged, ActionNameChanged, ActionTagChanged, ViewerRefresh};
102 
104 
105  virtual void updateActionWidget(camitk::Action*);
107 
109  void updateSearchPanel(UpdateReason);
110 
112  QWidget* myWidget;
113 
115  QComboBox* familyComboBox;
116 
118  QComboBox* nameComboBox;
119 
122 
124  QLineEdit* tagLineEdit;
125 
127  QStackedWidget* actionWidgetStack;
128 
131 
134 
136  QMap<camitk::ComponentList, camitk::Action*> widgetHistory;
137 
140 };
141 
142 
143 #endif // ACTIONVIEWER_H
#define ACTIONVIEWER_API
Definition: ActionViewerAPI.h:54
ActionViewer is the viewer used to manage the actions.
Definition: ActionViewer.h:63
QWidget * myWidget
Main action widget of the viewer.
Definition: ActionViewer.h:112
UpdateReason
Enum the different fields of the action viewwer.
Definition: ActionViewer.h:101
@ ActionFamilyChanged
Definition: ActionViewer.h:101
camitk::Action * action
Current action.
Definition: ActionViewer.h:121
QComboBox * familyComboBox
Family combo box.
Definition: ActionViewer.h:115
int emptyActionWidgetIndex
index of the empty widget, used when no action is active or when no action has been used for the curr...
Definition: ActionViewer.h:133
QStackedWidget * actionWidgetStack
actions stacked widget of the viewer
Definition: ActionViewer.h:127
QFrame * searchFramePanel
the search panel
Definition: ActionViewer.h:130
camitk::ComponentList currentlySelected
Used to evaluate modification of the list while execution.
Definition: ActionViewer.h:139
QComboBox * nameComboBox
Action name combo box.
Definition: ActionViewer.h:118
QLineEdit * tagLineEdit
action tags line edit
Definition: ActionViewer.h:124
QMap< camitk::ComponentList, camitk::Action * > widgetHistory
this map stores the list of selected component and the corresponding stack index of their embedded ac...
Definition: ActionViewer.h:136
Action class is an abstract class that enables you to build a action (generally on a component).
Definition: Action.h:208
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
virtual QWidget * getWidget()=0
get the viewer widget.
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127