OpenWalnut
1.5.0dev
|
Class building the base for all widgets representing properties. More...
#include <WPropertyWidget.h>
Public Member Functions | |
WPropertyWidget (std::shared_ptr< WPropertyBase > property, QGridLayout *propertyGrid, QWidget *parent=0) | |
Constructor. More... | |
virtual | ~WPropertyWidget () |
Destructor. More... | |
std::shared_ptr< WPropertyBase > | getProperty () |
Returns the handled property. More... | |
virtual void | invalidate (bool invalid=true) |
This method marks this widget as invalid. More... | |
virtual std::string | getTooltip () const |
Gets the tooltip that should be used for this widget. More... | |
QWidget * | getParameterWidgets () |
Returns the parameter widget for this property. More... | |
QWidget * | getInformationWidgets () |
Returns the info widget for this property. More... | |
virtual void | requestUpdate () |
Request an update of the property widget. More... | |
void | forceInformationMode (bool force=true) |
Force the widget to use the information widgets. More... | |
Static Public Member Functions | |
static WPropertyWidget * | construct (WPropertyBase::SPtr property, QGridLayout *propertyGrid=NULL, QWidget *parent=NULL) |
Constructs a proper widget for the specified property. More... | |
Protected Member Functions | |
virtual void | update ()=0 |
Called whenever the widget should update itself. More... | |
virtual bool | event (QEvent *event) |
Custom event dispatcher. More... | |
Protected Attributes | |
std::shared_ptr< WPropertyBase > | m_property |
The property handled by the widget. More... | |
QGridLayout * | m_propertyGrid |
The grid used to layout label and widget. More... | |
WScaleLabel | m_label |
The label used to name the property. More... | |
QWidget | m_separator |
Separator after each property. More... | |
bool | m_useLabel |
If set to true, the widgets uses the control layout to combine the widget with a label. More... | |
QWidget | m_parameterWidgets |
The widget containing a layout and provides the edit widgets for the property. More... | |
QWidget | m_informationWidgets |
The widget containing a layout and provides the widgets for showing information properties. More... | |
bool | m_invalid |
Flag denoting whether the widget is set to an invalid value. More... | |
boost::signals2::connection | m_connection |
The connection for propertyChangeNotifier(). More... | |
QColor | m_sepCol |
The color to use for separators. More... | |
QColor | m_labelCol |
The color to use for the property labels. More... | |
QColor | m_propertyCol |
The color to use for property widgets. More... | |
QColor | m_errorCol |
Color used for indicating errors. More... | |
Class building the base for all widgets representing properties.
It simply contains the handled property object.
Definition at line 44 of file WPropertyWidget.h.
WPropertyWidget::WPropertyWidget | ( | std::shared_ptr< WPropertyBase > | property, |
QGridLayout * | propertyGrid, | ||
QWidget * | parent = 0 |
||
) |
Constructor.
Creates a new widget appropriate for the specified property.
property | the property to handle |
parent | the parent widget. |
propertyGrid | the grid used to layout the labels and property widgets |
Definition at line 50 of file WPropertyWidget.cpp.
References WScaleLabel::addAdditionalWidth(), getTooltip(), m_connection, m_errorCol, m_informationWidgets, m_label, m_labelCol, m_parameterWidgets, m_property, m_propertyCol, m_propertyGrid, m_separator, m_sepCol, m_useLabel, requestUpdate(), and WScaleLabel::setText().
|
virtual |
|
static |
Constructs a proper widget for the specified property.
If the widget type is not supported, NULL is returned.
property | the property to create the widget for |
propertyGrid | grid to provide to he widget |
parent | parent of the widget |
Definition at line 215 of file WPropertyWidget.cpp.
References WLogger::addLogMessage(), and WLogger::getLogger().
Referenced by WQtPropertyGroupWidget::addProp(), and WPropertyStructWidget::WPropertyStructWidget().
|
protectedvirtual |
Custom event dispatcher.
Gets called by QT's Event system every time an event got sent to this widget. This event handler processes property change events.
event | the event that got transmitted. |
Definition at line 155 of file WPropertyWidget.cpp.
References m_label, m_property, m_separator, and update().
Referenced by WPropertyColorWidget::dragEnterEvent(), WPropertyFilenameWidget::dragEnterEvent(), WPropertyColorWidget::dropEvent(), and WPropertyFilenameWidget::dropEvent().
void WPropertyWidget::forceInformationMode | ( | bool | force = true | ) |
Force the widget to use the information widgets.
force | true to force |
Definition at line 139 of file WPropertyWidget.cpp.
References m_property.
Referenced by WQtRoiTreeItem::createWidget(), WQtBranchTreeItem::WQtBranchTreeItem(), and WQtColormapper::WQtTextureListItem::WQtTextureListItem().
QWidget * WPropertyWidget::getInformationWidgets | ( | ) |
Returns the info widget for this property.
Definition at line 210 of file WPropertyWidget.cpp.
References m_informationWidgets.
QWidget * WPropertyWidget::getParameterWidgets | ( | ) |
Returns the parameter widget for this property.
Definition at line 205 of file WPropertyWidget.cpp.
References m_parameterWidgets.
std::shared_ptr< WPropertyBase > WPropertyWidget::getProperty | ( | ) |
Returns the handled property.
Definition at line 179 of file WPropertyWidget.cpp.
References m_property.
|
virtual |
Gets the tooltip that should be used for this widget.
Definition at line 170 of file WPropertyWidget.cpp.
References m_invalid, and m_property.
Referenced by invalidate(), and WPropertyWidget().
|
virtual |
This method marks this widget as invalid.
This is useful to let the user know about wrong inputs.
invalid | true whenever the property widget should be marked as invalid |
Definition at line 184 of file WPropertyWidget.cpp.
References getTooltip(), m_errorCol, m_invalid, m_label, m_labelCol, and m_useLabel.
Referenced by WPropertyColorWidget::buttonClicked(), WPropertyFilenameWidget::buttonReleased(), WPropertyTriggerWidget::changed(), WPropertyBoolWidget::checkboxChanged(), WPropertySelectionWidget::comboSelectionChanged(), WPropertyColorWidget::dropEvent(), WPropertyFilenameWidget::dropEvent(), WPropertyDoubleWidget::editChanged(), WPropertyIntWidget::editChanged(), WPropertyStringWidget::editChanged(), WPropertySelectionWidget::listSelectionChanged(), WPropertyIntervalWidget::minMaxUpdated(), WPropertyMatrix4X4Widget::setPropertyFromWidgets(), WPropertyPositionWidget::setPropertyFromWidgets(), WPropertyDoubleWidget::sliderChanged(), WPropertyIntWidget::sliderChanged(), WPropertyDoubleWidget::textEdited(), WPropertyIntWidget::textEdited(), and WPropertyStringWidget::textEdited().
|
virtual |
Request an update of the property widget.
Can be called from any thread.
Definition at line 150 of file WPropertyWidget.cpp.
Referenced by WPropertyWidget().
|
protectedpure virtual |
Called whenever the widget should update itself.
Implemented in WPropertyTriggerWidget, WPropertyTransferFunctionWidget, WPropertyStructWidget, WPropertyStringWidget, WPropertySelectionWidget, WPropertyPositionWidget, WPropertyMatrix4X4Widget, WPropertyIntWidget, WPropertyIntervalWidget, WPropertyFilenameWidget, WPropertyDoubleWidget, WPropertyColorWidget, and WPropertyBoolWidget.
Referenced by event().
|
protected |
The connection for propertyChangeNotifier().
Definition at line 180 of file WPropertyWidget.h.
Referenced by WPropertyWidget(), and ~WPropertyWidget().
|
protected |
Color used for indicating errors.
Definition at line 200 of file WPropertyWidget.h.
Referenced by invalidate(), and WPropertyWidget().
|
protected |
The widget containing a layout and provides the widgets for showing information properties.
Definition at line 159 of file WPropertyWidget.h.
Referenced by getInformationWidgets(), WPropertyBoolWidget::WPropertyBoolWidget(), WPropertyColorWidget::WPropertyColorWidget(), WPropertyDoubleWidget::WPropertyDoubleWidget(), WPropertyFilenameWidget::WPropertyFilenameWidget(), WPropertyIntervalWidget::WPropertyIntervalWidget(), WPropertyIntWidget::WPropertyIntWidget(), WPropertyMatrix4X4Widget::WPropertyMatrix4X4Widget(), WPropertyPositionWidget::WPropertyPositionWidget(), WPropertySelectionWidget::WPropertySelectionWidget(), WPropertyStringWidget::WPropertyStringWidget(), WPropertyTransferFunctionWidget::WPropertyTransferFunctionWidget(), WPropertyTriggerWidget::WPropertyTriggerWidget(), and WPropertyWidget().
|
protected |
Flag denoting whether the widget is set to an invalid value.
Definition at line 164 of file WPropertyWidget.h.
Referenced by getTooltip(), and invalidate().
|
protected |
The label used to name the property.
Definition at line 139 of file WPropertyWidget.h.
Referenced by event(), invalidate(), and WPropertyWidget().
|
protected |
The color to use for the property labels.
Definition at line 190 of file WPropertyWidget.h.
Referenced by invalidate(), and WPropertyWidget().
|
protected |
The widget containing a layout and provides the edit widgets for the property.
Definition at line 154 of file WPropertyWidget.h.
Referenced by getParameterWidgets(), WPropertyBoolWidget::WPropertyBoolWidget(), WPropertyColorWidget::WPropertyColorWidget(), WPropertyDoubleWidget::WPropertyDoubleWidget(), WPropertyFilenameWidget::WPropertyFilenameWidget(), WPropertyIntervalWidget::WPropertyIntervalWidget(), WPropertyIntWidget::WPropertyIntWidget(), WPropertyMatrix4X4Widget::WPropertyMatrix4X4Widget(), WPropertyPositionWidget::WPropertyPositionWidget(), WPropertySelectionWidget::WPropertySelectionWidget(), WPropertyStringWidget::WPropertyStringWidget(), WPropertyStructWidget::WPropertyStructWidget(), WPropertyTransferFunctionWidget::WPropertyTransferFunctionWidget(), WPropertyTriggerWidget::WPropertyTriggerWidget(), and WPropertyWidget().
|
protected |
The property handled by the widget.
Definition at line 129 of file WPropertyWidget.h.
Referenced by event(), forceInformationMode(), getProperty(), getTooltip(), WPropertySelectionWidget::WPropertySelectionWidget(), and WPropertyWidget().
|
protected |
The color to use for property widgets.
Definition at line 195 of file WPropertyWidget.h.
Referenced by WPropertyWidget().
|
protected |
The grid used to layout label and widget.
Definition at line 134 of file WPropertyWidget.h.
Referenced by WPropertyWidget().
|
protected |
Separator after each property.
Definition at line 144 of file WPropertyWidget.h.
Referenced by event(), and WPropertyWidget().
|
protected |
The color to use for separators.
Definition at line 185 of file WPropertyWidget.h.
Referenced by WPropertyWidget().
|
protected |
If set to true, the widgets uses the control layout to combine the widget with a label.
Definition at line 149 of file WPropertyWidget.h.
Referenced by invalidate(), and WPropertyWidget().