Workspace 6.21.5
Public Types | Signals | Public Member Functions | List of all members
WorkspaceController Class Reference

Class for providing a model-based interface to a workspace. More...

#include <Workspace/Presentation/workspacecontroller.h>

Inherits QObject.

Public Types

enum  {
  LabelColumn = 0 , GlobalNameColumn , UuidColumn , PathColumn ,
  OpTypeColumn , ColumnCount
}
 
enum  DataRoles {
  UpdatableItem = Qt::UserRole , OperationItem , WorkspaceItem , InputScalarItem ,
  InputArrayItem , InputArrayElementItem , OutputItem
}
 

Signals

void editWorkspace (CSIRO::DataExecution::Workspace *workspace)
 
void inputScalarDeleted (CSIRO::DataExecution::InputScalar *inScalar)
 
void operationDeleted (CSIRO::DataExecution::Operation *op)
 
void requestShowOperationInWorkflowTree (CSIRO::DataExecution::Operation *ws)
 
void rootWorkspaceChanged ()
 
void rootWorkspaceUpdate (CSIRO::DataExecution::Workspace *workspace)
 

Public Member Functions

 WorkspaceController (DataExecution::Workspace *workspace=nullptr, QObject *parent=nullptr)
 
 ~WorkspaceController () override
 
void customContextMenu (const QModelIndex &index)
 
QModelIndex getIndex (const QUuid &operationId)
 
QModelIndex getIndex (DataExecution::Operation &operation)
 
WorkspaceModelItemgetItem (const QModelIndex &index)
 
QItemSelectionModel & getItemSelectionModel ()
 
QAbstractItemModel & getModel ()
 
DataExecution::OperationgetOperation (const QModelIndex &index, bool fallbackToParent=false)
 
DataExecution::WorkspacegetWorkspace ()
 
const DataExecution::WorkspacegetWorkspace () const
 
GlobalNameTrackerglobalNameTracker ()
 
void notifyInputScalarDeleted (CSIRO::DataExecution::InputScalar &inScalar)
 
void notifyOperationDeleted (CSIRO::DataExecution::Operation &op)
 
void notifyWorkspaceCleared ()
 
void setWorkspace (DataExecution::Workspace &workspace, bool takeOwnership=true)
 

Detailed Description

This class provides a model-based interface. More importantly, it also provides a selection model which can be shared among various widgets to show a consistent selection state across all widgets. This is particularly useful when the user interface has multiple views present for the same workspace, as is often the case. For example, a WorkspaceTabWidget and a WorkspaceTreeWidget could both be shown to give alternative ways of interacting with the same workspace hierarchy.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LabelColumn 
GlobalNameColumn 
UuidColumn 
PathColumn 
OpTypeColumn 
ColumnCount 

◆ DataRoles

enum DataRoles

Various roles are defined for storing pointers in an item's data. Some item types will store data for more than one of these roles (eg a Workspace will store data in both the WorkspaceItem and OperationItem roles). If an item does not have data for a given role, attempts to request that data will result in a null QVariant.

Enumerator
UpdatableItem 

This will generally be present for all item types.

OperationItem 

This will also be present for Workspace items.

WorkspaceItem 
InputScalarItem 
InputArrayItem 
InputArrayElementItem 
OutputItem 

Constructor & Destructor Documentation

◆ WorkspaceController()

WorkspaceController ( DataExecution::Workspace workspace = nullptr,
QObject *  parent = nullptr 
)
Parameters
workspaceThe workspace to use as the root workspace of the controller. The controller will take ownership of workspace. If you need to prevent the controller from taking ownership, pass a null pointer and call setWorkspace() with its takeOwnership parameter set to false.
parentThe parent object for the controller.

◆ ~WorkspaceController()

~WorkspaceController ( )
overridedefault

Member Function Documentation

◆ customContextMenu()

void customContextMenu ( const QModelIndex &  index)

◆ editWorkspace

void editWorkspace ( CSIRO::DataExecution::Workspace workspace)
signal

◆ getIndex() [1/2]

QModelIndex getIndex ( const QUuid &  operationId)
Parameters
operationIdThe ID of the operation for which model index is being sought.
Returns
The index of the specified operation or an invalid index if the operation is not present in the controller's model (which would mean that the operation is not part of the workspace hierarchy that this controller is working with).

◆ getIndex() [2/2]

QModelIndex getIndex ( DataExecution::Operation operation)
Parameters
operationThe operation for which the model index is being sought.
Returns
The index of the specified operation or an invalid index if the operation is not present in the controller's model (which would mean that the operation is not part of the workspace hierarchy that this controller is working with).

◆ getItem()

WorkspaceModelItem * getItem ( const QModelIndex &  index)

◆ getItemSelectionModel()

QItemSelectionModel & getItemSelectionModel ( )

◆ getModel()

QAbstractItemModel & getModel ( )

◆ getOperation()

DataExecution::Operation * getOperation ( const QModelIndex &  index,
bool  fallbackToParent = false 
)
Parameters
indexThe index of the item for which the corresponding operation is being sought.
fallbackToParentIf the item at the specified index is not an operation and the fallbackToParent parameter is true, then the function attempts to find out what operation the item belongs to an will return that operation. This generally means that the item at index is an input or output and the operation to which that input or output belongs will be returned.
Returns
The operation for the specified index. If index refers to an item that does not represent an operation (and fallbackToParent is false), or if index is invalid or belongs to the wrong model, a null pointer will be returned instead.

◆ getWorkspace() [1/2]

Workspace & getWorkspace ( )
Returns
The current root workspace of this controller.

◆ getWorkspace() [2/2]

const Workspace & getWorkspace ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ globalNameTracker()

GlobalNameTracker & globalNameTracker ( )

◆ inputScalarDeleted

void inputScalarDeleted ( CSIRO::DataExecution::InputScalar inScalar)
signal

◆ notifyInputScalarDeleted()

void notifyInputScalarDeleted ( CSIRO::DataExecution::InputScalar inScalar)

◆ notifyOperationDeleted()

void notifyOperationDeleted ( CSIRO::DataExecution::Operation op)

◆ notifyWorkspaceCleared()

void notifyWorkspaceCleared ( )

◆ operationDeleted

void operationDeleted ( CSIRO::DataExecution::Operation op)
signal

◆ requestShowOperationInWorkflowTree

void requestShowOperationInWorkflowTree ( CSIRO::DataExecution::Operation ws)
signal

◆ rootWorkspaceChanged

void rootWorkspaceChanged ( )
signal

◆ rootWorkspaceUpdate

void rootWorkspaceUpdate ( CSIRO::DataExecution::Workspace workspace)
signal

◆ setWorkspace()

void setWorkspace ( DataExecution::Workspace workspace,
bool  takeOwnership = true 
)
Parameters
workspaceThe workspace to use as the new root workspace for this controller.
takeOwnershipIf true, the controller will take ownership of the workspace and ensure it is deleted when the controller is deleted or when setWorkspace() is called again with a different workspace.
Note
If workspace is already the root workspace for this controller, the function call has no effect.