Computer Assited Medical Intervention Tool Kit  version 5.0
objectcontroller.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 **
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of a Qt Solutions component.
9 **
10 ** You may use this file under the terms of the BSD license as follows:
11 **
12 ** "Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
14 ** met:
15 ** * Redistributions of source code must retain the above copyright
16 ** notice, this list of conditions and the following disclaimer.
17 ** * Redistributions in binary form must reproduce the above copyright
18 ** notice, this list of conditions and the following disclaimer in
19 ** the documentation and/or other materials provided with the
20 ** distribution.
21 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 ** the names of its contributors may be used to endorse or promote
23 ** products derived from this software without specific prior written
24 ** permission.
25 **
26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 **
38 ****************************************************************************/
39 
40 #ifndef OBJECTCONTROLLER_H
41 #define OBJECTCONTROLLER_H
42 
43 #include <QtGui/QWidget>
44 
46 
47 class ObjectController : public QWidget {
48  Q_OBJECT
49 public:
50  ObjectController(QWidget* parent = 0);
52 
53  void setObject(QObject* object);
54  QObject* object() const;
55 
56 private:
58  Q_DECLARE_PRIVATE(ObjectController)
59  Q_DISABLE_COPY(ObjectController)
60  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty*, const QVariant&))
61 };
62 
63 #endif
ObjectControllerPrivate::m_object
QObject * m_object
Definition: objectcontroller.cpp:104
camitk::ObjectControllerPrivate::enumToInt
int enumToInt(const QMetaEnum &metaEnum, int enumValue) const
Definition: ObjectController.cpp:69
camitk::ObjectControllerPrivate::m_indexToDynamicProperty
QMap< int, QtVariantProperty * > m_indexToDynamicProperty
map from idx of the dynamic property to the property
Definition: ObjectController.h:299
camitk::ObjectControllerPrivate::groupProperties
QMap< QString, QtProperty * > groupProperties
map of all the QtProperty that are top-level groups
Definition: ObjectController.h:326
QtProperty::setStatusTip
void setStatusTip(const QString &text)
Definition: qtpropertybrowser.cpp:318
camitk::ObjectControllerPrivate::valueChanged
void valueChanged(QtProperty *property, const QVariant value)
Definition: ObjectController.cpp:493
camitk::ObjectControllerPrivate::addClassProperties
void addClassProperties(const QMetaObject *metaObject)
Definition: ObjectController.cpp:314
camitk::Property::getEnumIcons
QMap< int, QIcon > getEnumIcons() const
get the enum icons
Definition: Property.cpp:148
camitk::ObjectController::initViewMode
void initViewMode()
initialize the view mode depending on currentViewMode
Definition: ObjectController.cpp:651
camitk::ObjectControllerPrivate::m_dynamicPropertyToIndex
QMap< QtProperty *, int > m_dynamicPropertyToIndex
map from the dynamic property to the idx in the dynamic property
Definition: ObjectController.h:301
camitk::ObjectControllerPrivate::saveChangeValue
QMap< QtProperty *, QVariant > saveChangeValue
when a property is modified by the user, the change is stored here (until applyChange is called)
Definition: ObjectController.h:310
QtTreePropertyBrowser
The description of this class will come soon !
Definition: qttreepropertybrowser.h:60
ObjectControllerPrivate::m_propertyToExpanded
QMap< QtProperty *, bool > m_propertyToExpanded
Definition: objectcontroller.cpp:111
ObjectController
Definition: objectcontroller.h:47
ObjectControllerPrivate::slotValueChanged
void slotValueChanged(QtProperty *property, const QVariant &value)
Definition: objectcontroller.cpp:313
ObjectControllerPrivate::m_manager
QtVariantPropertyManager * m_manager
Definition: objectcontroller.cpp:116
camitk::Property::getGroupName
QString getGroupName() const
get this property subgroup's name
Definition: Property.cpp:158
camitk::ObjectControllerPrivate::saveExpandedState
void saveExpandedState()
Definition: ObjectController.cpp:485
camitk::ObjectController::~ObjectController
~ObjectController() override
destructor of object controller
Definition: ObjectController.cpp:572
camitk::ObjectControllerPrivate::m_manager
QtVariantPropertyManager * m_manager
the main property manager (does not include the read only property)
Definition: ObjectController.h:316
qtbuttonpropertybrowser.h
QtTreePropertyBrowser::setRootIsDecorated
void setRootIsDecorated(bool show)
Definition: qttreepropertybrowser.cpp:789
QtAbstractPropertyBrowser
QtAbstractPropertyBrowser provides a base class for implementing property browsers.
Definition: qtpropertybrowser.h:301
camitk::ObjectControllerPrivate::m_classToIndexToProperty
QMap< const QMetaObject *, QMap< int, QtVariantProperty * > > m_classToIndexToProperty
Each meta object have a map to get the property by its index.
Definition: ObjectController.h:296
QtProperty::setEnabled
void setEnabled(bool enable)
Definition: qtpropertybrowser.cpp:362
ObjectControllerPrivate::updateClassProperties
void updateClassProperties(const QMetaObject *metaObject, bool recursive)
Definition: objectcontroller.cpp:186
ObjectControllerPrivate::m_classToIndexToProperty
QMap< const QMetaObject *, QMap< int, QtVariantProperty * > > m_classToIndexToProperty
Definition: objectcontroller.cpp:109
ObjectController::d_ptr
ObjectControllerPrivate * d_ptr
Definition: objectcontroller.h:57
ObjectControllerPrivate::m_classToProperty
QMap< const QMetaObject *, QtProperty * > m_classToProperty
Definition: objectcontroller.cpp:106
camitk::ObjectControllerPrivate::isSubValue
bool isSubValue(int value, int subValue) const
Definition: ObjectController.cpp:108
QtVariantPropertyManager::enumTypeId
static int enumTypeId()
Definition: qtvariantproperty.cpp:91
camitk::ObjectController::TREE
@ TREE
The property browser can be shown like a QListView.
Definition: ObjectController.h:195
QtAbstractPropertyBrowser::addProperty
QtBrowserItem * addProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:1771
camitk::ObjectController::ViewMode
ViewMode
Definition: ObjectController.h:194
camitk::ObjectController::apply
void apply()
slot to apply change made by the user in the property editor
Definition: ObjectController.cpp:681
camitk::ObjectControllerPrivate::saveChange
void saveChange(QtProperty *property, const QVariant &value)
Definition: ObjectController.cpp:528
QtVariantPropertyManager
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition: qtvariantproperty.h:119
camitk::ObjectControllerPrivate::intToFlag
int intToFlag(const QMetaEnum &metaEnum, int intValue) const
Definition: ObjectController.cpp:165
QtProperty
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:113
camitk::ObjectControllerPrivate::m_readOnlyManager
QtVariantPropertyManager * m_readOnlyManager
the property manager for the read only property
Definition: ObjectController.h:319
camitk::ObjectController::layout
QVBoxLayout * layout
layout which will contains the propertybrowser and, in view mode GROUPBOX and BUTTON,...
Definition: ObjectController.h:256
QtVariantPropertyManager::flagTypeId
static int flagTypeId()
Definition: qtvariantproperty.cpp:104
ObjectControllerPrivate::addClassProperties
void addClassProperties(const QMetaObject *metaObject)
Definition: objectcontroller.cpp:221
ObjectControllerPrivate::m_propertyToIndex
QMap< QtProperty *, int > m_propertyToIndex
Definition: objectcontroller.cpp:108
qtpropertybrowser.h
ObjectController::setObject
void setObject(QObject *object)
Definition: objectcontroller.cpp:375
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
QtVariantPropertyManager::addProperty
virtual QtVariantProperty * addProperty(int propertyType, const QString &name=QString())
Definition: qtvariantproperty.cpp:1321
camitk::ObjectControllerPrivate::m_browser
QtAbstractPropertyBrowser * m_browser
the browser where all properties are shown to the user
Definition: ObjectController.h:313
QtAbstractPropertyBrowser::setFactoryForManager
void setFactoryForManager(PropertyManager *manager, QtAbstractEditorFactory< PropertyManager > *factory)
Definition: qtpropertybrowser.h:315
camitk::ObjectControllerPrivate::isPowerOf2
bool isPowerOf2(int value) const
Definition: ObjectController.cpp:129
QtProperty::setWhatsThis
void setWhatsThis(const QString &text)
Definition: qtpropertybrowser.cpp:332
ObjectControllerPrivate::saveExpandedState
void saveExpandedState()
Definition: objectcontroller.cpp:305
camitk::ObjectControllerPrivate::applyChange
void applyChange()
Definition: ObjectController.cpp:532
camitk::ObjectControllerPrivate::m_object
QObject * m_object
the currently edited object
Definition: ObjectController.h:287
ObjectControllerPrivate::q_ptr
ObjectController * q_ptr
Definition: objectcontroller.cpp:88
QtVariantProperty
The QtVariantProperty class is a convenience class handling QVariant based properties.
Definition: qtvariantproperty.h:97
ObjectControllerPrivate::restoreExpandedState
void restoreExpandedState()
Definition: objectcontroller.cpp:309
camitk::ObjectControllerPrivate::flagToInt
int flagToInt(const QMetaEnum &metaEnum, int flagValue) const
Definition: ObjectController.cpp:141
camitk::ObjectController::setObject
void setObject(QObject *object)
mutatorMethod of the object at unroll in the property browser
Definition: ObjectController.cpp:576
QtButtonPropertyBrowser
The description of this class will come soon !
Definition: qtbuttonpropertybrowser.h:59
Property.h
camitk::ObjectController::valueChanged
void valueChanged(QtProperty *, const QVariant &)) ViewMode currentViewMode
variable to choose the type of property browser
QtGroupBoxPropertyBrowser
The description of this class will come soon !
Definition: qtgroupboxpropertybrowser.h:59
camitk::ObjectController::object
QObject * object() const
accessorMethod of the object contains in the property browser
Definition: ObjectController.cpp:610
camitk::Property::getReadOnly
bool getReadOnly() const
Definition: Property.cpp:87
QtProperty::setToolTip
void setToolTip(const QString &text)
Definition: qtpropertybrowser.cpp:304
ObjectControllerPrivate::m_readOnlyManager
QtVariantPropertyManager * m_readOnlyManager
Definition: objectcontroller.cpp:117
camitk::ObjectController::scroll
QScrollArea * scroll
scroll add to navigate in the property browser
Definition: ObjectController.h:259
qtvariantproperty.h
camitk::ObjectController::isModified
bool isModified()
call this to check if a modification was done
Definition: ObjectController.cpp:677
description
const char * description
Definition: applications/cepgenerator/main.cpp:38
ObjectControllerPrivate::intToFlag
int intToFlag(const QMetaEnum &metaEnum, int intValue) const
Definition: objectcontroller.cpp:160
camitk::ObjectControllerPrivate::updateDynamicProperties
void updateDynamicProperties(const QObject *edited)
Definition: ObjectController.cpp:362
qtgroupboxpropertybrowser.h
ObjectController::ObjectController
ObjectController(QWidget *parent=0)
Definition: objectcontroller.cpp:339
camitk::Property::getAttributeList
QStringList getAttributeList()
returns the list of attribute names that are specific to this property
Definition: Property.cpp:178
QtVariantEditorFactory
The QtVariantEditorFactory class provides widgets for properties created by QtVariantPropertyManager ...
Definition: qtvariantproperty.h:212
QtAbstractPropertyBrowser::removeProperty
void removeProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:1838
camitk::ObjectController::setAutoUpdateProperty
void setAutoUpdateProperty(bool)
if set, the properties are immediatly updated in the managed object (default false)
Definition: ObjectController.cpp:615
camitk::Property::getEnumTypeName
QString getEnumTypeName() const
Definition: Property.cpp:103
ObjectControllerPrivate::m_browser
QtAbstractPropertyBrowser * m_browser
Definition: objectcontroller.cpp:115
ObjectController.h
camitk::ObjectControllerPrivate::addDynamicProperties
void addDynamicProperties(QObject *edited)
Definition: ObjectController.cpp:384
QtTreePropertyBrowser::Interactive
@ Interactive
Definition: qttreepropertybrowser.h:72
camitk::ObjectController::getViewMode
ViewMode getViewMode() const
accessorMethod of the view mode
Definition: ObjectController.cpp:673
camitk::ObjectControllerPrivate::m_topLevelProperties
QList< QtProperty * > m_topLevelProperties
TODO doc.
Definition: ObjectController.h:307
ObjectControllerPrivate::enumToInt
int enumToInt(const QMetaEnum &metaEnum, int enumValue) const
Definition: objectcontroller.cpp:83
ObjectControllerPrivate
Definition: objectcontroller.cpp:50
camitk::ObjectControllerPrivate::m_classPropertyToIndex
QMap< QtProperty *, int > m_classPropertyToIndex
map from the class property to the index in the meta object
Definition: ObjectController.h:294
camitk::ObjectController::BUTTON
@ BUTTON
It is like the GROUPBOX but the buttons allow the user to control the comput display of arborescence.
Definition: ObjectController.h:197
QtVariantProperty::setValue
void setValue(const QVariant &value)
Definition: qtvariantproperty.cpp:263
ObjectController::object
QObject * object() const
Definition: objectcontroller.cpp:400
camitk::Property::getAttribute
QVariant getAttribute(QString attName)
get the current value of a given attribute, see setAttribute() if the attribute attName was never set...
Definition: Property.cpp:168
qttreepropertybrowser.h
camitk::ObjectController::setViewMode
void setViewMode(ViewMode viewMode)
mutator Method of the view mode
Definition: ObjectController.cpp:626
camitk::ObjectController::d_ptr
ObjectControllerPrivate * d_ptr
private object controller wich contains pointer about object, browser and more
Definition: ObjectController.h:239
ObjectController::~ObjectController
~ObjectController()
Definition: objectcontroller.cpp:371
camitk::ObjectController::ObjectController
ObjectController(QWidget *parent=nullptr, ViewMode viewMode=TREE)
constructor of object controller with in parameters the parent widget and the view mode (default : TR...
Definition: ObjectController.cpp:543
camitk::ObjectController::revert
void revert()
slot to revert the values of all properties (revert to values in memory)
Definition: ObjectController.cpp:685
ObjectControllerPrivate::m_topLevelProperties
QList< QtProperty * > m_topLevelProperties
Definition: objectcontroller.cpp:113
camitk::ObjectController::GROUPBOX
@ GROUPBOX
It is like the TREE but with a delimitation to indicate the arborescence of the property type.
Definition: ObjectController.h:196
camitk::Property::getDescription
const QString & getDescription() const
get the description
Definition: Property.cpp:97
camitk::ObjectControllerPrivate::intToEnum
int intToEnum(const QMetaEnum &metaEnum, int intValue) const
Definition: ObjectController.cpp:88
objectcontroller.h
QtVariantProperty::setAttribute
void setAttribute(const QString &attribute, const QVariant &value)
Definition: qtvariantproperty.cpp:276
ObjectControllerPrivate::intToEnum
int intToEnum(const QMetaEnum &metaEnum, int intValue) const
Definition: objectcontroller.cpp:98
QtVariantPropertyManager::isPropertyTypeSupported
virtual bool isPropertyTypeSupported(int propertyType) const
Definition: qtvariantproperty.cpp:1300
ObjectControllerPrivate::flagToInt
int flagToInt(const QMetaEnum &metaEnum, int flagValue) const
Definition: objectcontroller.cpp:141
camitk::ObjectControllerPrivate::updateClassProperties
void updateClassProperties(const QMetaObject *metaObject, bool recursive)
Definition: ObjectController.cpp:198
QtProperty::addSubProperty
void addSubProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:393
QtVariantProperty::value
QVariant value() const
Definition: qtvariantproperty.cpp:213
QtVariantPropertyManager::groupTypeId
static int groupTypeId()
Definition: qtvariantproperty.cpp:117
camitk::ObjectControllerPrivate::restoreExpandedState
void restoreExpandedState()
Definition: ObjectController.cpp:489
ObjectControllerPrivate::isPowerOf2
bool isPowerOf2(int value) const
Definition: objectcontroller.cpp:131
ObjectControllerPrivate::isSubValue
bool isSubValue(int value, int subValue) const
Definition: objectcontroller.cpp:114
ObjectControllerPrivate::m_propertyToClass
QMap< QtProperty *, const QMetaObject * > m_propertyToClass
Definition: objectcontroller.cpp:107
camitk::ObjectControllerPrivate::buildQtVariantProperty
QtVariantProperty * buildQtVariantProperty(QString name, QMetaType::Type type, QVariant value, bool isReadable, bool isWritable, bool isEnumType, bool isFlagType, bool isDesignable, QMetaEnum *metaEnum=NULL)
build a QtVariantProperty from name, type, property...etc...
Definition: ObjectController.cpp:230
camitk
Definition: Action.cpp:35
qtpropertymanager.h