Workspace 6.21.5
|
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) |
WorkspaceModelItem * | getItem (const QModelIndex &index) |
QItemSelectionModel & | getItemSelectionModel () |
QAbstractItemModel & | getModel () |
DataExecution::Operation * | getOperation (const QModelIndex &index, bool fallbackToParent=false) |
DataExecution::Workspace & | getWorkspace () |
const DataExecution::Workspace & | getWorkspace () const |
GlobalNameTracker & | globalNameTracker () |
void | notifyInputScalarDeleted (CSIRO::DataExecution::InputScalar &inScalar) |
void | notifyOperationDeleted (CSIRO::DataExecution::Operation &op) |
void | notifyWorkspaceCleared () |
void | setWorkspace (DataExecution::Workspace &workspace, bool takeOwnership=true) |
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.
anonymous enum |
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.
WorkspaceController | ( | DataExecution::Workspace * | workspace = nullptr , |
QObject * | parent = nullptr |
||
) |
workspace | The 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 . |
parent | The parent object for the controller. |
|
overridedefault |
void customContextMenu | ( | const QModelIndex & | index | ) |
|
signal |
QModelIndex getIndex | ( | const QUuid & | operationId | ) |
operationId | The ID of the operation for which model index is being sought. |
QModelIndex getIndex | ( | DataExecution::Operation & | operation | ) |
operation | The operation for which the model index is being sought. |
WorkspaceModelItem * getItem | ( | const QModelIndex & | index | ) |
QItemSelectionModel & getItemSelectionModel | ( | ) |
QAbstractItemModel & getModel | ( | ) |
DataExecution::Operation * getOperation | ( | const QModelIndex & | index, |
bool | fallbackToParent = false |
||
) |
index | The index of the item for which the corresponding operation is being sought. |
fallbackToParent | If 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. |
Workspace & getWorkspace | ( | ) |
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 | ( | ) |
|
signal |
void notifyInputScalarDeleted | ( | CSIRO::DataExecution::InputScalar & | inScalar | ) |
void notifyOperationDeleted | ( | CSIRO::DataExecution::Operation & | op | ) |
void notifyWorkspaceCleared | ( | ) |
|
signal |
|
signal |
|
signal |
|
signal |
void setWorkspace | ( | DataExecution::Workspace & | workspace, |
bool | takeOwnership = true |
||
) |
workspace | The workspace to use as the new root workspace for this controller. |
takeOwnership | If 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. |