Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
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 // -- Core stuff
29 #include "Viewer.h"
30 #include "ObjectController.h"
31 #include "PropertyObject.h"
32 
33 // -- QT stuff
34 #include <qteditorfactory.h>
35 #include <QtTreePropertyBrowser>
36 #include <QtButtonPropertyBrowser>
37 #include <QtGroupBoxPropertyBrowser>
38 
39 // -- QT stuff classes
40 class QTabWidget;
41 class QPushButton;
42 class QWidget;
43 
44 namespace camitk {
45 
46 
47 class ObjectController;
48 
83 class CAMITK_API PropertyExplorer : public Viewer {
84  Q_OBJECT
85  Q_ENUMS(camitk::ObjectController::ViewMode) // so that it can be used in property editor
86 
87 public:
90  PropertyExplorer();
93 
95  ~PropertyExplorer() override;
96 
98  static PropertyExplorer* getInstance();
100 
103  unsigned int numberOfViewedComponent() override;
106 
108  void refresh(Viewer* whoIsAsking = nullptr) override;
109 
111  QWidget* getWidget(QWidget* parent = nullptr) override;
112 
114  QObject* getPropertyObject() override;
116 
119 
123  void selectWidget(QWidget* widget);
124 
128  void selectIndex(unsigned int index);
129 
131 
132 
133 private:
134 
136  ObjectController* theController;
137  QTabWidget* tabWidget;
138  QPushButton* revertButton;
139  QPushButton* applyButton;
140 
142  Component* currentComponent;
143 
147 
151  PropertyObject* propertyObject;
152 
156  Property* viewModeProperty;
157 
162  bool eventFilter(QObject* object, QEvent* event) override;
163 
167  void createProperties();
168 
170 
174  void clear();
175 
176 private slots:
177 
183  void updateTabIndexToDisplay(int index);
184 
188  void refreshAll();
189 };
190 }
191 #endif
camitk::PropertyExplorer::updateTabIndexToDisplay
void updateTabIndexToDisplay(int index)
Update the PropertyExplorer tab index to display for the currently selected component This method is ...
Definition: PropertyExplorer.cpp:242
PropertyExplorer.h
camitk::PropertyExplorer::~PropertyExplorer
~PropertyExplorer() override
constructor
Definition: PropertyExplorer.cpp:74
ObjectController
Definition: objectcontroller.h:46
camitk::Component::getPropertyObject
QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:442
camitk::Application::getSettings
static QSettings & getSettings()
Get the Core wide settings.
Definition: Application.cpp:300
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:107
camitk::Application::refresh
static void refresh()
refresh the main window (this will call the refresh method of all viewers)
Definition: Application.cpp:317
qteditorfactory.h
camitk::PropertyExplorer::getInstance
static PropertyExplorer * getInstance()
returns the unique instance of the PropertyExplorer
Definition: PropertyExplorer.cpp:85
camitk::ObjectController::ViewMode
ViewMode
Definition: ObjectController.h:193
PropertyObject.h
camitk::PropertyExplorer::clear
void clear()
clear all the additional widgets, reset currentComponent (and update its visibility).
Definition: PropertyExplorer.cpp:209
camitk::Component::setIndexOfPropertyExplorerTab
void setIndexOfPropertyExplorerTab(unsigned int index)
Set the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:461
camitk::Application::getSelectedComponents
static const ComponentList & getSelectedComponents()
get the currently selected Components.
Definition: Application.cpp:894
camitk::PropertyExplorer::theController
ObjectController * theController
the widgets
Definition: PropertyExplorer.h:135
camitk::Property
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:312
camitk::Property::getName
const QString & getName() const
get the name of the property
Definition: Property.cpp:71
camitk::PropertyExplorer::selectWidget
void selectWidget(QWidget *widget)
Select the tab containing the given widget in the PropertyExplorer.
Definition: PropertyExplorer.cpp:222
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:183
camitk::PropertyExplorer::numberOfViewedComponent
unsigned int numberOfViewedComponent() override
Definition: PropertyExplorer.cpp:96
camitk::Component::getPropertyWidgetAt
QWidget * getPropertyWidgetAt(unsigned int i)
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:430
camitk::PropertyExplorer::createProperties
void createProperties()
Create and handle the CamiTK properties of this viewer.
Definition: PropertyExplorer.cpp:271
camitk::Property::setAttribute
void setAttribute(const QString &attribute, const QVariant &value)
Set a given property for this attribute.
Definition: Property.cpp:182
camitk::Component::getIndexOfPropertyExplorerTab
unsigned int getIndexOfPropertyExplorerTab()
Get the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:472
camitk::Component::setVisibility
virtual void setVisibility(Viewer *, bool)
set the visibility for a viewer
Definition: sdk/libraries/core/component/Component.cpp:275
camitk::PropertyExplorer::currentComponent
Component * currentComponent
the viewed Component
Definition: PropertyExplorer.h:141
camitk::PropertyExplorer::eventFilter
bool eventFilter(QObject *object, QEvent *event) override
Event filter of this class instance to watch its properties instances.
Definition: PropertyExplorer.cpp:250
ObjectController.h
camitk::PropertyExplorer::viewModeProperty
Property * viewModeProperty
The CamiTK property that stands for the ObjectController view mode.
Definition: PropertyExplorer.h:155
camitk::PropertyExplorer::refresh
void refresh(Viewer *whoIsAsking=nullptr) override
refresh the property editor
Definition: PropertyExplorer.cpp:106
camitk::PropertyExplorer::applyButton
QPushButton * applyButton
Definition: PropertyExplorer.h:138
camitk::PropertyExplorer::getWidget
QWidget * getWidget(QWidget *parent=nullptr) override
get the viewer widget.
Definition: PropertyExplorer.cpp:149
camitk::Q_ENUMS
Q_ENUMS(ControlMode CameraOrientation)
RendererWidget implements all support methods to use camiTK with Qt interface.
camitk::PropertyExplorer::tabWidget
QTabWidget * tabWidget
Definition: PropertyExplorer.h:136
camitk::ObjectController::BUTTON
It is like the GROUPBOX but the buttons allow the user to control the comput display of arborescence.
Definition: ObjectController.h:196
camitk::Application::isAlive
static bool isAlive(Component *)
does this Component still exists?
Definition: Application.cpp:828
camitk::Viewer
Viewer is an abstract viewer.
Definition: Viewer.h:54
camitk::PropertyExplorer::selectIndex
void selectIndex(unsigned int index)
Select the tab of the given index in the PropertyExplorer.
Definition: PropertyExplorer.cpp:235
camitk::ObjectController::setViewMode
void setViewMode(ViewMode viewMode)
mutator Method of the view mode
Definition: ObjectController.cpp:626
camitk::PropertyExplorer::getPropertyObject
QObject * getPropertyObject() override
add a property to change the ObjectController representation at run-time (user choice)
Definition: PropertyExplorer.cpp:204
camitk::Component::getNumberOfPropertyWidget
unsigned int getNumberOfPropertyWidget()
get the number of alternative property widgets
Definition: sdk/libraries/core/component/Component.h:422
Viewer.h
camitk::PropertyExplorer::propertyObject
PropertyObject * propertyObject
The property object that holds the properties of this viewer.
Definition: PropertyExplorer.h:150
camitk::refresh
void refresh()
refresh the display
camitk::PropertyObject::addProperty
virtual bool addProperty(Property *)
Tag a new CamiTK property to this object.
Definition: PropertyObject.cpp:75
camitk::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:294
camitk::PropertyObject
This class describes a property object.
Definition: PropertyObject.h:92
camitk::PropertyExplorer::revertButton
QPushButton * revertButton
Definition: PropertyExplorer.h:137
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:297
Application.h
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:48
camitk
Definition: Action.cpp:36