ezEngine Release 25.08
Loading...
Searching...
No Matches
ezQtExposedParametersPropertyWidget Class Reference

Custom widget for properties annotated with the ezExposedParametersAttribute attribute. Technically exposed parameters are stored as an ezVariantDictionary but that leaves much to be desired for usability. This class uses ezExposedParameterCommandAccessor to always show all exposed parameters in the dictionary even if none were overwritten. Additionally, ezExposedParametersAsTypeCommandAccessor is used to project the exposed parameters into a phantom type widget to make editing exposed parameters indistinguishable from editing a normal type object. A button can be used to switch between the two representations. More...

#include <ExposedParametersPropertyWidget.moc.h>

Inheritance diagram for ezQtExposedParametersPropertyWidget:

Public Member Functions

virtual void SetSelection (const ezHybridArray< ezPropertySelection, 8 > &items) override
 This is called whenever the selection in the editor changes and thus the widget may need to display a different value.
 
- Public Member Functions inherited from ezQtPropertyStandardTypeContainerWidget
 ezQtPropertyStandardTypeContainerWidget ()
 *** ezQtPropertyStandardTypeContainerWidget ***
 
- Public Member Functions inherited from ezQtPropertyContainerWidget
 ezQtPropertyContainerWidget ()
 *** ezQtPropertyContainerWidget ***
 
virtual bool HasLabel () const override
 If this returns true (default), a QLabel is created and the text that GetLabel() returns is displayed.
 
virtual void SetIsDefault (bool bIsDefault) override
 Whether the variable that the widget represents is currently set to the default value or has been modified.
 
- Public Member Functions inherited from ezQtPropertyWidget
 ezQtPropertyWidget ()
 *** BASE ***
 
void Init (ezQtPropertyGridWidget *pGrid, ezObjectAccessorBase *pObjectAccessor, const ezRTTI *pType, const ezAbstractProperty *pProp)
 
ezQtPropertyGridWidgetGetPropertyGrid ()
 
ezObjectAccessorBaseGetObjectAccessor ()
 
const ezRTTIGetType () const
 
const ezAbstractPropertyGetProperty () const
 
const ezHybridArray< ezPropertySelection, 8 > & GetSelection () const
 
virtual const char * GetLabel (ezStringBuilder &ref_sTmp) const
 The return value is used to display a label, if HasLabel() returns true.
 
virtual void ExtendContextMenu (QMenu &ref_menu)
 
bool GetCommonVariantSubType (const ezHybridArray< ezPropertySelection, 8 > &items, const ezAbstractProperty *pProperty, ezVariantType::Enum &out_type)
 If the property is of type ezVariant this function returns whether all items have the same type. If true is returned, out_Type contains the common type. Note that 'invalid' can be a common type.
 
ezVariant GetCommonValue (const ezHybridArray< ezPropertySelection, 8 > &items, const ezAbstractProperty *pProperty)
 
void PrepareToDie ()
 
virtual void SetReadOnly (bool bReadOnly=true)
 By default disables the widget, but can be overridden to make a widget more interactable (for example to be able to copy text from it).
 

Protected Member Functions

virtual void OnInit () override
 
virtual void UpdateElement (ezUInt32 index) override
 
virtual void UpdatePropertyMetaState () override
 
virtual void GetRequiredElements (ezDynamicArray< ezVariant > &out_keys) const override
 
- Protected Member Functions inherited from ezQtPropertyStandardTypeContainerWidget
virtual ezQtGroupBoxBaseCreateElement (QWidget *pParent) override
 
virtual ezQtPropertyWidgetCreateWidget (ezUInt32 index) override
 
virtual ElementAddElement (ezUInt32 index) override
 
virtual void RemoveElement (ezUInt32 index) override
 
- Protected Member Functions inherited from ezQtPropertyContainerWidget
void UpdateElements ()
 
virtual ezPropertyCategory::Enum GetContainerCategory () const
 Some containers like ezVariant can be both a map or an array so we can't reply on the property type alone. For these containers, this method can be overwritten to retrieve the category from something other than m_pProp->GetCategory().
 
void Clear ()
 
void DeleteItems (ezHybridArray< ezPropertySelection, 8 > &items)
 
void MoveItems (ezHybridArray< ezPropertySelection, 8 > &items, ezInt32 iMove)
 
virtual void DoPrepareToDie () override
 
virtual void dragEnterEvent (QDragEnterEvent *event) override
 
virtual void dragMoveEvent (QDragMoveEvent *event) override
 
virtual void dragLeaveEvent (QDragLeaveEvent *event) override
 
virtual void dropEvent (QDropEvent *event) override
 
virtual void paintEvent (QPaintEvent *event) override
 
virtual void showEvent (QShowEvent *event) override
 
- Protected Member Functions inherited from ezQtPropertyWidget
void Broadcast (ezPropertyEvent::Type type)
 
void PropertyChangedHandler (const ezPropertyEvent &ed)
 
bool IsUndead () const
 
virtual bool eventFilter (QObject *pWatched, QEvent *pEvent) override
 

Additional Inherited Members

- Public Slots inherited from ezQtPropertyContainerWidget
void OnElementButtonClicked ()
 
void OnDragStarted (QMimeData &ref_mimeData)
 
void OnContainerContextMenu (const QPoint &pt)
 
void OnCustomElementContextMenu (const QPoint &pt)
 
- Public Slots inherited from ezQtPropertyWidget
void OnCustomContextMenu (const QPoint &pt)
 
- Static Public Member Functions inherited from ezQtPropertyWidget
static const ezRTTIGetCommonBaseType (const ezHybridArray< ezPropertySelection, 8 > &items)
 
static QColor SetPaletteBackgroundColor (ezColorGammaUB inputColor, QPalette &ref_palette)
 
- Protected Attributes inherited from ezQtPropertyContainerWidget
QHBoxLayout * m_pLayout
 
ezQtGroupBoxBasem_pGroup
 
QVBoxLayout * m_pGroupLayout
 
ezQtAddSubElementButtonm_pAddButton = nullptr
 
QPalette m_Pal
 
ezHybridArray< ezVariant, 16 > m_Keys
 
ezDynamicArray< Elementm_Elements
 
ezInt32 m_iDropSource = -1
 
ezInt32 m_iDropTarget = -1
 
- Protected Attributes inherited from ezQtPropertyWidget
ezQtPropertyGridWidgetm_pGrid = nullptr
 
ezObjectAccessorBasem_pObjectAccessor = nullptr
 
const ezRTTIm_pType = nullptr
 
const ezAbstractPropertym_pProp = nullptr
 
ezHybridArray< ezPropertySelection, 8 > m_Items
 
bool m_bIsDefault
 Whether the variable that the widget represents is currently set to the default value or has been modified.
 

Detailed Description

Custom widget for properties annotated with the ezExposedParametersAttribute attribute. Technically exposed parameters are stored as an ezVariantDictionary but that leaves much to be desired for usability. This class uses ezExposedParameterCommandAccessor to always show all exposed parameters in the dictionary even if none were overwritten. Additionally, ezExposedParametersAsTypeCommandAccessor is used to project the exposed parameters into a phantom type widget to make editing exposed parameters indistinguishable from editing a normal type object. A button can be used to switch between the two representations.

Member Function Documentation

◆ GetRequiredElements()

void ezQtExposedParametersPropertyWidget::GetRequiredElements ( ezDynamicArray< ezVariant > &  out_keys) const
overrideprotectedvirtual

Reimplemented from ezQtPropertyContainerWidget.

◆ OnInit()

void ezQtExposedParametersPropertyWidget::OnInit ( )
overrideprotectedvirtual

Reimplemented from ezQtPropertyContainerWidget.

◆ SetSelection()

void ezQtExposedParametersPropertyWidget::SetSelection ( const ezHybridArray< ezPropertySelection, 8 > &  items)
overridevirtual

This is called whenever the selection in the editor changes and thus the widget may need to display a different value.

If the array holds more than one element, the user selected multiple objects. In this case, the code should check whether the values differ across the selected objects and if so, the widget should display "multiple values".

Reimplemented from ezQtPropertyContainerWidget.

◆ UpdateElement()

void ezQtExposedParametersPropertyWidget::UpdateElement ( ezUInt32  index)
overrideprotectedvirtual

◆ UpdatePropertyMetaState()

void ezQtExposedParametersPropertyWidget::UpdatePropertyMetaState ( )
overrideprotectedvirtual

Reimplemented from ezQtPropertyContainerWidget.


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