Privacy
An open-source, flexible 3D physical simulation framework
mars::main_gui::PropertyDialog Class Reference

The PropertyDialog provides the QtProperty functionality. More...

#include <PropertyDialog.h>

Public Slots

virtual void accept ()
 Associated with the OK button. More...
 
virtual void reject ()
 Associated with the Cancel button. More...
 

Signals

void geometryChanged ()
 Emitted when paintEvent is received. More...
 
void closeSignal ()
 Emitted when a QCloseEvent has been received. More...
 
void tabValueChanged (QtProperty *property, const QVariant &value)
 Emitted when a property in a tab has changed its value. More...
 

Public Member Functions

 PropertyDialog (QWidget *parent)
 A contructor. More...
 
virtual ~PropertyDialog ()
 A destructor. More...
 
QtVariantProperty * addGenericProperty (const std::string &path, int type, const QVariant &value, std::map< QString, QVariant > *attributes=NULL, QStringList *options=NULL)
 Creates a property. More...
 
QtVariantProperty * addGenericProperty (QtVariantProperty *parent, QtVariantProperty *property)
 Adds the property to the parent's subproperties. More...
 
QtVariantProperty * addTabbedProperty (const std::string &path, int type, const QVariant &value, std::map< QString, QVariant > *attributes=NULL, QStringList *options=NULL)
 Creates a PropertyDialog tab widget and adds the generic property to it. More...
 
QtVariantProperty * insertGenericProperty (QtVariantProperty *parent, QtVariantProperty *property, QtVariantProperty *after)
 Inserts the property to the parent's subproperties after the after property. More...
 
void removeGenericProperty (QtVariantProperty *property)
 Removes the property. More...
 
void removeAllSubProperties (QtVariantProperty *parent)
 Removes all subproperties of the parent property. More...
 
void destroyAllSubProperties (QtProperty *parent)
 Detaches and destroys all subproperties of the parent. More...
 
void addAllSubProperties (QtVariantProperty *parent, QList< QtVariantProperty *> list)
 Adds all properties from the list to the parent's subproperties. More...
 
void setPropertyColor (QtVariantProperty *property, QColor color)
 Sets the background color of a property in the Tree Property Browser. More...
 
QColor getPropertyColor (QtVariantProperty *property) const
 Returns the background color of the property in the Tree Property Browser. More...
 
QtProperty * activeItem (void)
 Returns the item that is currently focused on. More...
 
QtProperty * currentItem (void)
 Returns the top level item that is currently focused on. More...
 
void setCurrentItem (QtProperty *property)
 Sets the focus on the top level item property in the Tree Property Browser. More...
 
QPushButton * addGenericButton (const char *name, const QObject *recv, const char *method)
 Creates a QPushButton with the given name and connects its clicked() slot with the method of the receiver recv. More...
 
void setViewButtonVisibility (bool visible)
 Sets the visibility of the view button. More...
 
void setButtonBoxVisibility (bool visible)
 Sets the visibility of the button box. More...
 
void clearButtonBox (void)
 Removes all buttons from the button box. More...
 
void hideAllButtons (void)
 Hides the view button and the button box. More...
 
void setViewMode (const ViewMode &mode)
 Sets the view mode to either tree or button view mode. More...
 
void setPropCallback (PropertyCallback *pc)
 Sets the callback object. More...
 
ViewMode getViewMode (void) const
 Returns the current view mode. More...
 
void expandTree (QtProperty *item)
 Expands the branch of the property item. More...
 
void collapseTree (QtProperty *item)
 Collapses the branch of the property item. More...
 
bool isPropertyVisible (QtProperty *prop) const
 

Protected Slots

virtual void valueChanged (QtProperty *property, const QVariant &value)
 Called every time a property has changed its value. More...
 
virtual void currentItemChanged (QtBrowserItem *current)
 Called every time another branch of a QtTreePropertyBrowser has been selected. More...
 
void toggleView ()
 Switches between tree an button view modes. More...
 

Protected Member Functions

void customizeItem (QtVariantProperty *item, int type, const QVariant &value, std::map< QString, QVariant > *attributes=NULL, QStringList *options=NULL)
 Adjusts the attributes and value of a property. More...
 
virtual void closeEvent (QCloseEvent *event)
 Cleans up before closing. More...
 
void resizeEvent (QResizeEvent *event)
 Used for geometry handling. More...
 
void moveEvent (QMoveEvent *event)
 Used for geometry handling. More...
 

Protected Attributes

QVBoxLayout * vBoxLayout
 A vertical layout. More...
 
QHBoxLayout * hBoxLayout
 A horizontal layout. More...
 
QDialogButtonBox * buttonBox
 A container for the buttons. More...
 
QPushButton * viewButton
 A button that toggles the view mode. More...
 
QTabWidget * tabWidget
 A tab widget handling the tabbed view. More...
 
QScrollArea * scrollArea
 A scroll area for the property editors. More...
 
QtVariantEditorFactory * variantFactory
 The factory for the properties. More...
 
QtVariantPropertyManager * variantManager
 The manager of the properties. More...
 
QtTreePropertyBrowser * variantEditorTree
 The tree property browser. More...
 
QtButtonPropertyBrowser * variantEditorButton
 The button property browser. More...
 
PropertyCallbackpropertyCallback
 The callback instance associated with this instance. More...
 
QList< QtProperty * > myProperties
 Top level properties. More...
 
std::map< QString, PropertyDialog * > myTabs
 Tabs with their names. More...
 
int tabView
 An indicator for the tabbed view. More...
 
ViewMode viewMode
 The view mode of the dialog. More...
 

Private Member Functions

void expandTree (QList< QtBrowserItem *> list)
 
void collapseTree (QList< QtBrowserItem *> list)
 
QtProperty * getParent (QtProperty *parent, QtVariantProperty *property) const
 
QtProperty * getTopLevelParent (QtProperty *property) const
 

Detailed Description

The PropertyDialog provides the QtProperty functionality.

PropertyDialog allows creation and managemenet of properties of various types using the QtProperty extension.

Definition at line 69 of file PropertyDialog.h.

Constructor & Destructor Documentation

◆ PropertyDialog()

mars::main_gui::PropertyDialog::PropertyDialog ( QWidget *  parent)

A contructor.

Definition at line 42 of file PropertyDialog.cpp.

◆ ~PropertyDialog()

mars::main_gui::PropertyDialog::~PropertyDialog ( )
virtual

A destructor.

Definition at line 100 of file PropertyDialog.cpp.

Member Function Documentation

◆ accept

void mars::main_gui::PropertyDialog::accept ( void  )
virtualslot

Associated with the OK button.

Definition at line 500 of file PropertyDialog.cpp.

◆ activeItem()

QtProperty * mars::main_gui::PropertyDialog::activeItem ( void  )

Returns the item that is currently focused on.

Definition at line 466 of file PropertyDialog.cpp.

◆ addAllSubProperties()

void mars::main_gui::PropertyDialog::addAllSubProperties ( QtVariantProperty *  parent,
QList< QtVariantProperty *>  list 
)

Adds all properties from the list to the parent's subproperties.

Definition at line 347 of file PropertyDialog.cpp.

◆ addGenericButton()

QPushButton * mars::main_gui::PropertyDialog::addGenericButton ( const char *  name,
const QObject *  recv,
const char *  method 
)

Creates a QPushButton with the given name and connects its clicked() slot with the method of the receiver recv.

Definition at line 554 of file PropertyDialog.cpp.

◆ addGenericProperty() [1/2]

QtVariantProperty* mars::main_gui::PropertyDialog::addGenericProperty ( const std::string &  path,
int  type,
const QVariant &  value,
std::map< QString, QVariant > *  attributes = NULL,
QStringList *  options = NULL 
)

Creates a property.

Parameters
pathIf path begins with "../" then the property is created in this dialog else a tab widget is created.
typeA QVariant::Type.
valueThe initial value.
optionsItems for enumTypeId() and flagTypeId()

◆ addGenericProperty() [2/2]

QtVariantProperty * mars::main_gui::PropertyDialog::addGenericProperty ( QtVariantProperty *  parent,
QtVariantProperty *  property 
)

Adds the property to the parent's subproperties.

Definition at line 275 of file PropertyDialog.cpp.

◆ addTabbedProperty()

QtVariantProperty * mars::main_gui::PropertyDialog::addTabbedProperty ( const std::string &  path,
int  type,
const QVariant &  value,
std::map< QString, QVariant > *  attributes = NULL,
QStringList *  options = NULL 
)

Creates a PropertyDialog tab widget and adds the generic property to it.

Definition at line 105 of file PropertyDialog.cpp.

◆ clearButtonBox()

void mars::main_gui::PropertyDialog::clearButtonBox ( void  )

Removes all buttons from the button box.

Definition at line 576 of file PropertyDialog.cpp.

◆ closeEvent()

void mars::main_gui::PropertyDialog::closeEvent ( QCloseEvent *  event)
protectedvirtual

Cleans up before closing.

Definition at line 512 of file PropertyDialog.cpp.

◆ closeSignal

void mars::main_gui::PropertyDialog::closeSignal ( )
signal

Emitted when a QCloseEvent has been received.

◆ collapseTree() [1/2]

void mars::main_gui::PropertyDialog::collapseTree ( QtProperty *  item)

Collapses the branch of the property item.

Definition at line 270 of file PropertyDialog.cpp.

◆ collapseTree() [2/2]

void mars::main_gui::PropertyDialog::collapseTree ( QList< QtBrowserItem *>  list)
private

Definition at line 250 of file PropertyDialog.cpp.

◆ currentItem()

QtProperty * mars::main_gui::PropertyDialog::currentItem ( void  )

Returns the top level item that is currently focused on.

Definition at line 482 of file PropertyDialog.cpp.

◆ currentItemChanged

void mars::main_gui::PropertyDialog::currentItemChanged ( QtBrowserItem *  current)
protectedvirtualslot

Called every time another branch of a QtTreePropertyBrowser has been selected.

Parameters
currentThe current top level item that is selected.

Definition at line 456 of file PropertyDialog.cpp.

◆ customizeItem()

void mars::main_gui::PropertyDialog::customizeItem ( QtVariantProperty *  item,
int  type,
const QVariant &  value,
std::map< QString, QVariant > *  attributes = NULL,
QStringList *  options = NULL 
)
protected

Adjusts the attributes and value of a property.

Definition at line 419 of file PropertyDialog.cpp.

◆ destroyAllSubProperties()

void mars::main_gui::PropertyDialog::destroyAllSubProperties ( QtProperty *  parent)

Detaches and destroys all subproperties of the parent.

Definition at line 355 of file PropertyDialog.cpp.

◆ expandTree() [1/2]

void mars::main_gui::PropertyDialog::expandTree ( QtProperty *  item)

Expands the branch of the property item.

Definition at line 266 of file PropertyDialog.cpp.

◆ expandTree() [2/2]

void mars::main_gui::PropertyDialog::expandTree ( QList< QtBrowserItem *>  list)
private

Definition at line 258 of file PropertyDialog.cpp.

◆ geometryChanged

void mars::main_gui::PropertyDialog::geometryChanged ( )
signal

Emitted when paintEvent is received.

◆ getParent()

QtProperty * mars::main_gui::PropertyDialog::getParent ( QtProperty *  parent,
QtVariantProperty *  property 
) const
private

Definition at line 369 of file PropertyDialog.cpp.

◆ getPropertyColor()

QColor mars::main_gui::PropertyDialog::getPropertyColor ( QtVariantProperty *  property) const

Returns the background color of the property in the Tree Property Browser.

Definition at line 398 of file PropertyDialog.cpp.

◆ getTopLevelParent()

QtProperty * mars::main_gui::PropertyDialog::getTopLevelParent ( QtProperty *  property) const
private

Definition at line 407 of file PropertyDialog.cpp.

◆ getViewMode()

ViewMode mars::main_gui::PropertyDialog::getViewMode ( void  ) const

Returns the current view mode.

Definition at line 586 of file PropertyDialog.cpp.

◆ hideAllButtons()

void mars::main_gui::PropertyDialog::hideAllButtons ( void  )

Hides the view button and the button box.

Definition at line 571 of file PropertyDialog.cpp.

◆ insertGenericProperty()

QtVariantProperty * mars::main_gui::PropertyDialog::insertGenericProperty ( QtVariantProperty *  parent,
QtVariantProperty *  property,
QtVariantProperty *  after 
)

Inserts the property to the parent's subproperties after the after property.

Definition at line 288 of file PropertyDialog.cpp.

◆ isPropertyVisible()

bool mars::main_gui::PropertyDialog::isPropertyVisible ( QtProperty *  prop) const

Definition at line 595 of file PropertyDialog.cpp.

◆ moveEvent()

void mars::main_gui::PropertyDialog::moveEvent ( QMoveEvent *  event)
protected

Used for geometry handling.

Definition at line 549 of file PropertyDialog.cpp.

◆ reject

void mars::main_gui::PropertyDialog::reject ( void  )
virtualslot

Associated with the Cancel button.

Definition at line 506 of file PropertyDialog.cpp.

◆ removeAllSubProperties()

void mars::main_gui::PropertyDialog::removeAllSubProperties ( QtVariantProperty *  parent)

Removes all subproperties of the parent property.

Definition at line 336 of file PropertyDialog.cpp.

◆ removeGenericProperty()

void mars::main_gui::PropertyDialog::removeGenericProperty ( QtVariantProperty *  property)

Removes the property.

Definition at line 300 of file PropertyDialog.cpp.

◆ resizeEvent()

void mars::main_gui::PropertyDialog::resizeEvent ( QResizeEvent *  event)
protected

Used for geometry handling.

Definition at line 544 of file PropertyDialog.cpp.

◆ setButtonBoxVisibility()

void mars::main_gui::PropertyDialog::setButtonBoxVisibility ( bool  visible)

Sets the visibility of the button box.

Definition at line 563 of file PropertyDialog.cpp.

◆ setCurrentItem()

void mars::main_gui::PropertyDialog::setCurrentItem ( QtProperty *  property)

Sets the focus on the top level item property in the Tree Property Browser.

Definition at line 449 of file PropertyDialog.cpp.

◆ setPropCallback()

void mars::main_gui::PropertyDialog::setPropCallback ( PropertyCallback pc)

Sets the callback object.

Definition at line 591 of file PropertyDialog.cpp.

◆ setPropertyColor()

void mars::main_gui::PropertyDialog::setPropertyColor ( QtVariantProperty *  property,
QColor  color 
)

Sets the background color of a property in the Tree Property Browser.

Definition at line 390 of file PropertyDialog.cpp.

◆ setViewButtonVisibility()

void mars::main_gui::PropertyDialog::setViewButtonVisibility ( bool  visible)

Sets the visibility of the view button.

Definition at line 567 of file PropertyDialog.cpp.

◆ setViewMode()

void mars::main_gui::PropertyDialog::setViewMode ( const ViewMode mode)

Sets the view mode to either tree or button view mode.

Definition at line 580 of file PropertyDialog.cpp.

◆ tabValueChanged

void mars::main_gui::PropertyDialog::tabValueChanged ( QtProperty *  property,
const QVariant &  value 
)
signal

Emitted when a property in a tab has changed its value.

Forwarded to the corresponding TabPropertyDialog.

◆ toggleView

void mars::main_gui::PropertyDialog::toggleView ( )
protectedslot

Switches between tree an button view modes.

Definition at line 525 of file PropertyDialog.cpp.

◆ valueChanged

void mars::main_gui::PropertyDialog::valueChanged ( QtProperty *  property,
const QVariant &  value 
)
protectedvirtualslot

Called every time a property has changed its value.

Parameters
propertyThe property with a new value.
valueThe new value.

Definition at line 441 of file PropertyDialog.cpp.

Member Data Documentation

◆ buttonBox

QDialogButtonBox* mars::main_gui::PropertyDialog::buttonBox
protected

A container for the buttons.

Definition at line 228 of file PropertyDialog.h.

◆ hBoxLayout

QHBoxLayout* mars::main_gui::PropertyDialog::hBoxLayout
protected

A horizontal layout.

Definition at line 226 of file PropertyDialog.h.

◆ myProperties

QList<QtProperty*> mars::main_gui::PropertyDialog::myProperties
protected

Top level properties.

Definition at line 248 of file PropertyDialog.h.

◆ myTabs

std::map<QString, PropertyDialog*> mars::main_gui::PropertyDialog::myTabs
protected

Tabs with their names.

Definition at line 250 of file PropertyDialog.h.

◆ propertyCallback

PropertyCallback* mars::main_gui::PropertyDialog::propertyCallback
protected

The callback instance associated with this instance.

Definition at line 245 of file PropertyDialog.h.

◆ scrollArea

QScrollArea* mars::main_gui::PropertyDialog::scrollArea
protected

A scroll area for the property editors.

Definition at line 234 of file PropertyDialog.h.

◆ tabView

int mars::main_gui::PropertyDialog::tabView
protected

An indicator for the tabbed view.

Definition at line 252 of file PropertyDialog.h.

◆ tabWidget

QTabWidget* mars::main_gui::PropertyDialog::tabWidget
protected

A tab widget handling the tabbed view.

Definition at line 232 of file PropertyDialog.h.

◆ variantEditorButton

QtButtonPropertyBrowser* mars::main_gui::PropertyDialog::variantEditorButton
protected

The button property browser.

Definition at line 243 of file PropertyDialog.h.

◆ variantEditorTree

QtTreePropertyBrowser* mars::main_gui::PropertyDialog::variantEditorTree
protected

The tree property browser.

Definition at line 241 of file PropertyDialog.h.

◆ variantFactory

QtVariantEditorFactory* mars::main_gui::PropertyDialog::variantFactory
protected

The factory for the properties.

Definition at line 237 of file PropertyDialog.h.

◆ variantManager

QtVariantPropertyManager* mars::main_gui::PropertyDialog::variantManager
protected

The manager of the properties.

Definition at line 239 of file PropertyDialog.h.

◆ vBoxLayout

QVBoxLayout* mars::main_gui::PropertyDialog::vBoxLayout
protected

A vertical layout.

Definition at line 224 of file PropertyDialog.h.

◆ viewButton

QPushButton* mars::main_gui::PropertyDialog::viewButton
protected

A button that toggles the view mode.

Definition at line 230 of file PropertyDialog.h.

◆ viewMode

ViewMode mars::main_gui::PropertyDialog::viewMode
protected

The view mode of the dialog.

Definition at line 254 of file PropertyDialog.h.


The documentation for this class was generated from the following files: