Workspace 6.21.5
Classes | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
CustomOperationProperties Class Referenceabstract

Interface class for custom property handling on operations. More...

#include <Workspace/Presentation/customoperationproperties.h>

Inheritance diagram for CustomOperationProperties:
[legend]

Classes

class  PropertiesViaWidget
 Convenience class for implementing CustomOperationProperties via its properties widget. More...
 

Public Member Functions

virtual ~CustomOperationProperties ()=default
 
virtual void addProperties (OperationPropertiesDialog &dialog)=0
 
virtual bool allowedToApplyChanges ()=0
 
virtual void applyChanges (QUndoStack &undoStack)=0
 

Static Public Member Functions

template<typename WidgetT , typename OperationT >
static CustomOperationPropertiespropertiesViaWidget (OperationT &op)
 

Related Functions

(Note that these are not member functions.)

template<typename WidgetT , typename OperationT >
CustomOperationPropertiespropertiesViaWidget (OperationT &op)
 

Detailed Description

Constructor & Destructor Documentation

◆ ~CustomOperationProperties()

virtual ~CustomOperationProperties ( )
virtualdefault

Member Function Documentation

◆ addProperties()

virtual void addProperties ( OperationPropertiesDialog dialog)
pure virtual
Parameters
dialogThe dialog to which the custom properties should be added.

Subclasses would normally implement this function by creating widget pages and adding them through OperationPropertiesDialog::addPropertyPage().

Implemented in CustomOperationProperties::PropertiesViaWidget< WidgetT, OperationT >, ModifyGroupProperties, RunMatLabScriptProperties, and ModifyObjectDictionaryProperties.

◆ allowedToApplyChanges()

virtual bool allowedToApplyChanges ( )
pure virtual
Returns
True if the custom properties as set in the dialog can be accepted/applied. If the subclass is going to return false, it should also present a message box to the user explaining why the changes cannot not be accepted.

Custom properties often relate to changes that are unsafe to make while a workspace is executing. If the subclass has this restriction, one of the first things that allowedToApplyChanges() would typically contain is code like the following:

return false;
static bool canAllowTask(DataExecution::Updatable &updatable, bool promptAndStop=true)
Definition: stillexecutingchecker.cpp:60

where op_ is a private member variable holding a reference to the operation in question. What the above will do is check for execution and ask the user if they want to stop it or cancel the current task (in this case changing the properties).

Note
This function must not try to apply the property changes. It should only check to see if the changes could be applied.
See also
applyChanges()

Implemented in RunMatLabScriptProperties, CustomOperationProperties::PropertiesViaWidget< WidgetT, OperationT >, ModifyGroupProperties, and ModifyObjectDictionaryProperties.

◆ applyChanges()

virtual void applyChanges ( QUndoStack &  undoStack)
pure virtual
Parameters
undoStackThe stack onto which the undoable commands must be pushed. The caller is responsible for ensuring that undoStack is appropriate for this object's operation.

This function will be called when the caller requires the object's custom properties to be saved to the operation. The operation's custom properties cannot be manipulated directly, they must only be changed through undoable events pushed onto the undoStack provided. Note that the command(s) pushed onto the undoStack will appear as separate command(s) to the one used to change the general properties, so the name of the undoable command(s) should be chosen with this in mind. If more than one undoable command will be pushed on to the undoStack, it is recommended that they be grouped into a single logical command with undoStack.beginMacro() and undoStack.endMacro().

See also
allowedToApplyChanges()

Implemented in RunMatLabScriptProperties, CustomOperationProperties::PropertiesViaWidget< WidgetT, OperationT >, ModifyGroupProperties, and ModifyObjectDictionaryProperties.

◆ propertiesViaWidget()

static CustomOperationProperties * propertiesViaWidget ( OperationT &  op)
static

Friends And Related Function Documentation

◆ propertiesViaWidget()

CustomOperationProperties * propertiesViaWidget ( OperationT &  op)
related

Convenience function to allow argument type deduction on the operation type. Only the widget type needs to be explicitly specified when using this function. See the CustomOperationProperties documentation for more details.