![]() |
Computer Assited Medical Intervention Tool Kit
|
The object controller class. More...
#include <ObjectController.h>
Public Slots | |
void | apply () |
slot to apply change made by the user in the property editor | |
void | revert () |
slot to revert the values of all properties (revert to values in memory) |
Private Member Functions | |
ViewMode | getViewMode () const |
accessorMethod of the view mode | |
void | initViewMode () |
initialize the view mode depending on currentViewMode | |
bool | isModified () |
call this to check if a modification was done | |
QObject * | object () const |
accessorMethod of the object contains in the property browser | |
ObjectController (QWidget *parent=0, ViewMode viewMode=TREE) | |
constructor of object controller with in parameters the parent widget and the view mode (default : TREE) | |
Q_PRIVATE_SLOT (d_func(), void saveChange(QtProperty *, const QVariant &)) Q_PRIVATE_SLOT(d_func() | |
void | setAutoUpdateProperty (bool) |
if set, the properties are immediatly updated in the managed object (default false) | |
void | setObject (QObject *object) |
mutatorMethod of the object at unroll in the property browser | |
void | setViewMode (ViewMode viewMode) |
mutator Method of the view mode | |
void | valueChanged (QtProperty *, const QVariant &)) ViewMode currentViewMode |
variable to choose the type of property browser | |
~ObjectController () | |
destructor of object controller |
Private Attributes | |
ObjectControllerPrivate * | d_ptr |
private object controller wich contains pointer about object, browser and more | |
QVBoxLayout * | layout |
layout which will contains the propertybrowser and, in view mode GROUPBOX and BUTTON, the scroll | |
QScrollArea * | scroll |
scroll add to navigate in the property browser |
The object controller class.
This is a special "magical" widget. It allows to show the meta properties and dynamic property (see Qt Object Model / Property for lmore information on these).
A complete example that show the usability of object controller is available in applications "objectcontroller". The best way to learn how to use this Core facility is to look at this application and the given TestClass.
An object controller is a sort of property browser where each line represents a property. The object controller automatically build a GUI to access and optionally changed the properties you defined.
There could be many different types of properties, and as many as you want.
In order to handle a list of specific properties for your class, you have two choices:
The second choice does even not need a new class. You have to create a new QObject instance, and add as many dynamic properties as you wish using QObject::setProperty method. You also have to install an event monitor in your class to be notified when a property has changed (see TestClass in "objectcontroller" application).
Three different view mode are available to represent/interact with the property values:
The view mode can be changed at any time, even at run-time (see the "objectcontroller" application).
How to use this class:
The available property type are (see example in the "objectcontroller" application (tutorials), and see also QtVariantProperty in tools/qpropertybrowser for a complete list of associated constraints):
Property Type | Property Type Id |
---|---|
int | QVariant::Int |
double | QVariant::Double |
bool | QVariant::Bool |
QString | QVariant::String |
QVector3D | QVariant::QVector3D |
QColor | QVariant::Color |
QDate | QVariant::Date |
QTime | QVariant::Time |
QChar | QVariant::Char |
QDateTime | QVariant::DateTime |
QPoint | Variant::Point |
QPointF | QVariant::PointF |
QKeySequence | QVariant::KeySequence |
QLocale | QVariant::Locale |
QSize | QVariant::Size |
QSizeF | QVariant::SizeF |
QRect | QVariant::Rect |
QRectF | QVariant::RectF |
QSizePolicy | QVariant::SizePolicy |
QFont | QVariant::Font |
QCursor | QVariant::Cursor |
enum | enumTypeId() |
flag | flagTypeId() |
group | groupTypeId() |
|
private |
constructor of object controller with in parameters the parent widget and the view mode (default : TREE)
References d_ptr, initViewMode(), layout, camitk::ObjectControllerPrivate::m_browser, camitk::ObjectControllerPrivate::m_manager, camitk::ObjectControllerPrivate::m_object, camitk::ObjectControllerPrivate::m_readOnlyManager, camitk::ObjectControllerPrivate::q_ptr, scroll, and setAutoUpdateProperty().
|
private |
destructor of object controller
References d_ptr.
|
slot |
slot to apply change made by the user in the property editor
References camitk::ObjectControllerPrivate::applyChange(), and d_ptr.
Referenced by camitk::SettingsDialog::accept(), and camitk::SettingsDialog::on_objectList_itemSelectionChanged().
|
private |
accessorMethod of the view mode
|
private |
initialize the view mode depending on currentViewMode
References d_ptr, layout, camitk::ObjectControllerPrivate::m_browser, and scroll.
Referenced by ObjectController(), and setViewMode().
|
private |
call this to check if a modification was done
References d_ptr, and camitk::ObjectControllerPrivate::saveChangeValue.
Referenced by camitk::SettingsDialog::accept(), and camitk::SettingsDialog::on_objectList_itemSelectionChanged().
|
private |
accessorMethod of the object contains in the property browser
References d_ptr, and camitk::ObjectControllerPrivate::m_object.
Referenced by PropertyUI::print(), revert(), setObject(), and setViewMode().
|
private |
|
slot |
slot to revert the values of all properties (revert to values in memory)
References d_ptr, object(), camitk::ObjectControllerPrivate::saveChangeValue, and setObject().
|
private |
if set, the properties are immediatly updated in the managed object (default false)
References d_ptr, camitk::ObjectControllerPrivate::m_manager, and valueChanged().
Referenced by ObjectController(), and camitk::ActionWidget::setAutoUpdateProperty().
|
private |
mutatorMethod of the object at unroll in the property browser
References camitk::ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), d_ptr, camitk::ObjectControllerPrivate::m_browser, camitk::ObjectControllerPrivate::m_object, camitk::ObjectControllerPrivate::m_topLevelProperties, object(), camitk::ObjectControllerPrivate::restoreExpandedState(), camitk::ObjectControllerPrivate::saveChangeValue, and camitk::ObjectControllerPrivate::saveExpandedState().
Referenced by camitk::ActionWidget::ActionWidget(), camitk::SettingsDialog::editSettings(), camitk::SettingsDialog::on_objectList_itemSelectionChanged(), revert(), PropertyUI::setPropertyObject(), setViewMode(), and camitk::ActionWidget::updateTargets().
|
private |
mutator Method of the view mode
References d_ptr, initViewMode(), layout, camitk::ObjectControllerPrivate::m_browser, object(), scroll, and setObject().
Referenced by PropertyUI::changeViewMode().
|
private |
variable to choose the type of property browser
Referenced by setAutoUpdateProperty().
|
private |
private object controller wich contains pointer about object, browser and more
Referenced by apply(), initViewMode(), isModified(), object(), ObjectController(), revert(), setAutoUpdateProperty(), setObject(), setViewMode(), and ~ObjectController().
|
private |
layout which will contains the propertybrowser and, in view mode GROUPBOX and BUTTON, the scroll
Referenced by initViewMode(), ObjectController(), and setViewMode().
|
private |
scroll add to navigate in the property browser
Referenced by initViewMode(), ObjectController(), and setViewMode().