Computer Assited Medical Intervention Tool Kit  version 5.0
PropertyExplorer.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 #ifndef PROPERTYEXPLORER_H
26 #define PROPERTYEXPLORER_H
27 
28 #include "PropertyExplorerAPI.h"
29 
30 // -- Core stuff
31 #include <Viewer.h>
32 #include <ObjectController.h>
33 #include <PropertyObject.h>
34 
35 // -- QT stuff
36 #include <QtTreePropertyBrowser>
37 #include <QtButtonPropertyBrowser>
38 #include <QtGroupBoxPropertyBrowser>
39 
40 // -- QT stuff classes
41 class QTabWidget;
42 class QPushButton;
43 class QWidget;
44 
45 namespace camitk {
46 class ObjectController;
47 }
48 
82  Q_OBJECT
83  Q_ENUMS(camitk::ObjectController::ViewMode); // so that it can be used in property editor
84 
85 public:
88  Q_INVOKABLE PropertyExplorer(QString name);
91 
93  ~PropertyExplorer() override;
95 
98  void refresh(camitk::Viewer* whoIsAsking = nullptr) override;
101 
103  QWidget* getWidget() override;
104 
106  QObject* getPropertyObject() override;
108 
111 
115  void selectWidget(QWidget* widget);
116 
120  void selectIndex(unsigned int index);
121 
123 
124 
125 private:
126 
129  QTabWidget* tabWidget;
130  QPushButton* revertButton;
131  QPushButton* applyButton;
132 
135 
139 
144 
149 
154  bool eventFilter(QObject* object, QEvent* event) override;
155 
159  void createProperties();
160 
162 
166  void clear();
167 
168 private slots:
169 
175  void updateTabIndexToDisplay(int index);
176 
180  void refreshAll();
181 };
182 
183 #endif
camitk::Viewer::setDescription
void setDescription(QString)
set the viewer's description
Definition: Viewer.cpp:104
PropertyExplorer::updateTabIndexToDisplay
void updateTabIndexToDisplay(int index)
Update the PropertyExplorer tab index to display for the currently selected component This method is ...
Definition: PropertyExplorer.cpp:208
PropertyExplorer::revertButton
QPushButton * revertButton
Definition: PropertyExplorer.h:130
PropertyExplorer::propertyObject
camitk::PropertyObject * propertyObject
The property object that holds the properties of this viewer.
Definition: PropertyExplorer.h:143
PropertyExplorer.h
ObjectController
Definition: objectcontroller.h:47
camitk::Property::setEnumTypeName
void setEnumTypeName(QString)
if the property's type is an enum, set the name of the registered Qt Enum.
Definition: Property.cpp:108
PropertyExplorer::viewModeProperty
camitk::Property * viewModeProperty
The CamiTK property that stands for the ObjectController view mode.
Definition: PropertyExplorer.h:148
camitk::Component::setIndexOfPropertyExplorerTab
void setIndexOfPropertyExplorerTab(unsigned int index) override final
Set the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:492
camitk::Component::getNumberOfPropertyWidget
unsigned int getNumberOfPropertyWidget() override
get the number of alternative property widgets
Definition: sdk/libraries/core/component/Component.h:453
camitk::ObjectController::ViewMode
ViewMode
Definition: ObjectController.h:194
PropertyObject.h
PropertyExplorer::clear
void clear()
clear all the additional widgets, reset currentComponent (and update its visibility).
Definition: PropertyExplorer.cpp:170
PropertyExplorer::PropertyExplorer
Q_INVOKABLE PropertyExplorer(QString name)
Definition: PropertyExplorer.cpp:42
PropertyExplorer::refresh
void refresh(camitk::Viewer *whoIsAsking=nullptr) override
Definition: PropertyExplorer.cpp:64
PropertyExplorer::~PropertyExplorer
~PropertyExplorer() override
destructor
Definition: PropertyExplorer.cpp:55
PropertyExplorer::refreshAll
void refreshAll()
Refresh all the application when a property has changed, the best is to refresh the viewer to avoid m...
Definition: PropertyExplorer.cpp:260
camitk::Component::getIndexOfPropertyExplorerTab
unsigned int getIndexOfPropertyExplorerTab() override
Get the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:503
camitk::Property
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:303
camitk::Property::getName
const QString & getName() const
get the name of the property
Definition: Property.cpp:72
camitk::Viewer::setIcon
void setIcon(QPixmap icon)
set the default icon for the viewer extension
Definition: Viewer.cpp:84
camitk::Viewer::getName
QString getName() const
get the name of the viewer
Definition: Viewer.h:200
camitk::ObjectController::setObject
void setObject(QObject *object)
mutatorMethod of the object at unroll in the property browser
Definition: ObjectController.cpp:576
camitk::ObjectController
The object controller class.
Definition: ObjectController.h:185
camitk::Property::setAttribute
void setAttribute(const QString &attribute, const QVariant &value)
Set a given property for this attribute.
Definition: Property.cpp:183
PropertyExplorer::selectIndex
void selectIndex(unsigned int index)
Select the tab of the given index in the PropertyExplorer.
Definition: PropertyExplorer.cpp:201
PropertyExplorer::eventFilter
bool eventFilter(QObject *object, QEvent *event) override
Event filter of this class instance to watch its properties instances.
Definition: PropertyExplorer.cpp:216
PropertyExplorer::currentComponent
camitk::Component * currentComponent
the viewed Component
Definition: PropertyExplorer.h:134
ObjectController.h
PropertyExplorer::applyButton
QPushButton * applyButton
Definition: PropertyExplorer.h:131
camitk::Component::setVisibility
virtual void setVisibility(QString, bool)
set the visibility inside the viewer of the given name (the viewer needs to be a registered viewer)
Definition: sdk/libraries/core/component/Component.cpp:224
camitk::Viewer
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
camitk::ObjectController::setViewMode
void setViewMode(ViewMode viewMode)
mutator Method of the view mode
Definition: ObjectController.cpp:626
PropertyExplorer::createProperties
void createProperties()
Create and handle the CamiTK properties of this viewer.
Definition: PropertyExplorer.cpp:237
PropertyExplorer
The property explorer.
Definition: PropertyExplorer.h:81
camitk::Viewer::getWidget
virtual QWidget * getWidget()=0
get the viewer widget.
PROPERTYEXPLORER_API
#define PROPERTYEXPLORER_API
Definition: PropertyExplorerAPI.h:54
Viewer.h
camitk::Viewer::refresh
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
camitk::Viewer::getPropertyObject
virtual QObject * getPropertyObject()
get the viewer property object (returns nullptr by default, i.e. there are no property to edit)
Definition: Viewer.h:240
PropertyExplorer::theController
camitk::ObjectController * theController
the widgets
Definition: PropertyExplorer.h:128
PropertyExplorer::getWidget
QWidget * getWidget() override
get the viewer widget.
Definition: PropertyExplorer.cpp:110
camitk::refresh
void refresh()
refresh the display
PropertyExplorer::getPropertyObject
QObject * getPropertyObject() override
add a property to change the ObjectController representation at run-time (user choice)
Definition: PropertyExplorer.cpp:165
camitk::PropertyObject::addProperty
virtual bool addProperty(Property *)
Tag a new CamiTK property to this object.
Definition: PropertyObject.cpp:76
PropertyExplorerAPI.h
camitk::Component::getPropertyWidgetAt
QWidget * getPropertyWidgetAt(unsigned int) override
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:461
camitk::PropertyObject
This class describes a property object.
Definition: PropertyObject.h:94
camitk::Component
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:302
Application.h
camitk
Definition: Action.cpp:35
camitk::Component::getPropertyObject
QObject * getPropertyObject() override
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:473
PropertyExplorer::selectWidget
void selectWidget(QWidget *widget)
Select the tab containing the given widget in the PropertyExplorer.
Definition: PropertyExplorer.cpp:186
PropertyExplorer::tabWidget
QTabWidget * tabWidget
Definition: PropertyExplorer.h:129