Abstract base class for all front-end command line module implementations.
More...
#include <Libs/CommandLineModules/Core/ctkCmdLineModuleFrontend.h>
Abstract base class for all front-end command line module implementations.
A module front-end represents a set of current parameter values for a specific module. A front-end instance is usually associated with a graphical user interface, accessible via guiHandle(). This allows users to interactively change parameter values of the module.
- See also
- ctkCmdLineModuleFrontendQtGui
-
ctkCmdLineModuleFrontendQtWebKit
Definition at line 52 of file ctkCmdLineModuleFrontend.h.
◆ ParameterFilter
Enumerator |
---|
Input | Parameters with channel = "input"
|
Output | Parameter with channel = "output"
|
All | A convenience enum value combining Input and Output.
|
Definition at line 93 of file ctkCmdLineModuleFrontend.h.
◆ ParameterValueRole
Enumerator |
---|
LocalResourceRole | Data returned using this role must not be of any type not supported by QVariant by default. For complex parameter types (like file, image, geometry, etc.) the data must be convertible to a QString pointing to a local resource.
This role is usually used by backends for retrieving data and is mainly important for data which acts as a handle to the real data (e.g. a backend usually needs to get the absolute path to a local file for the current value of an input image parameter, instead of the image label displayed in a GUI).
|
DisplayRole | Describes data suitable for displaying in a GUI. For many parameter types (e.g. scalar and vector parameters) data returned by this role will be the same as returned by the LocalResourceRole role.
|
UserRole | This role can be used in custom frontends to return a QVariant containing for example an in-memory representation of a complex object. One can then either convert the in-memory representation to a local resource before running a module such that arbitrary backends relying on the LocalResourceRole role can process the data. Or one creates a custom backend which knows how to handle QVariants returned by this role.
|
Definition at line 59 of file ctkCmdLineModuleFrontend.h.
◆ ~ctkCmdLineModuleFrontend()
virtual ctkCmdLineModuleFrontend::~ctkCmdLineModuleFrontend |
( |
| ) |
|
|
virtual |
◆ ctkCmdLineModuleFrontend()
◆ future()
Return the ctkCmdLineModuleFuture, derived from QFuture to provide asynchronous processing and interaction with the running frontend.
Note that the future returned by this method will be different after the frontend was started. Either use isRunning() to check wether this frontend is currently running or connect to the started() signal.
- See also
- ctkCmdLineModuleFuture
◆ guiHandle()
virtual QObject* ctkCmdLineModuleFrontend::guiHandle |
( |
| ) |
const |
|
pure virtual |
Returns the GUI representation.
- Returns
- A GUI handle that can then be embeded in an application window for instance.
The returned object is a handle to the real GUI toolkit specific object representing the user interface. For Qt based front-ends, the returned object is usually a QWidget instance pointing to the main container widget for the GUI. See the documentation of the front-end sub-class for specific information.
Implemented in ctkCmdLineModuleFrontendQtGui.
◆ isPaused()
bool ctkCmdLineModuleFrontend::isPaused |
( |
| ) |
const |
Indicates if the currently associated ctkCmdLineModuleFuture Object is in state "paused".
- Returns
true
if paused and false
otherwise.
◆ isRunning()
bool ctkCmdLineModuleFrontend::isRunning |
( |
| ) |
const |
Indicates if the currently associated ctkCmdLineModuleFuture object is in state "running".
- Returns
true
if running and false
otherwise.
◆ location()
QUrl ctkCmdLineModuleFrontend::location |
( |
| ) |
const |
Returns a QUrl to define the location of the module that is run.
For a local process this may be the file location of the command line module. For other implementations, such as a web-service, this could be a web URL.
- Returns
- QUrl A resource independent URL defining where the module is.
◆ moduleReference()
◆ parameterNames()
virtual QList<QString> ctkCmdLineModuleFrontend::parameterNames |
( |
| ) |
const |
|
virtual |
◆ parameters()
Useful method to return subsets of parameter objects, searhing by type for example "image" and filter for example "input"/"output".
- Parameters
-
type | The type of parameter, as defined in the XML element. |
filters | flag to define whether we want input/output. |
- Returns
- QList of ctkCmdLineModuleParameter depending on type and filters.
- See also
- ParameterFilter
◆ resetValues()
void ctkCmdLineModuleFrontend::resetValues |
( |
| ) |
|
◆ setValue()
virtual void ctkCmdLineModuleFrontend::setValue |
( |
const QString & |
parameter, |
|
|
const QVariant & |
value, |
|
|
int |
role = DisplayRole |
|
) |
| |
|
pure virtual |
Set the value of a certain parameter.
- Parameters
-
parameter | The name of the parameter, as defined in the XML. |
value | The value for that parameter. |
role | The role for which to set the data. |
- See also
- ParameterValueRole
Implemented in ctkCmdLineModuleFrontendQtGui.
◆ setValues()
virtual void ctkCmdLineModuleFrontend::setValues |
( |
const QHash< QString, QVariant > & |
values | ) |
|
|
virtual |
Enables the parameter values to be set.
◆ started
void ctkCmdLineModuleFrontend::started |
( |
| ) |
|
|
signal |
This signal is emitted when the frontend is run.
You can use this signal to get the ctkCmdLineModuleFuture instance from future() to interact with the running frontend.
◆ value()
virtual QVariant ctkCmdLineModuleFrontend::value |
( |
const QString & |
parameter, |
|
|
int |
role = LocalResourceRole |
|
) |
| const |
|
pure virtual |
◆ valueChanged
void ctkCmdLineModuleFrontend::valueChanged |
( |
const QString & |
parameter, |
|
|
const QVariant & |
value |
|
) |
| |
|
signal |
This signal is emitted whenever a parameter value is changed by using the ctkCmdLineModuleFrontend class.
- Parameters
-
parameter | The parameter name. |
value | The new parameter value. |
Please note that this signal is not emitted if a parameter value is changed in the generated GUI.
◆ values()
virtual QHash<QString,QVariant> ctkCmdLineModuleFrontend::values |
( |
| ) |
const |
|
virtual |
Returns a map of parameter names and values.
◆ ctkCmdLineModuleFrontendPrivate
friend struct ctkCmdLineModuleFrontendPrivate |
|
friend |
◆ ctkCmdLineModuleManager
◆ ctkCmdLineModulePrivate
friend class ctkCmdLineModulePrivate |
|
friend |
The documentation for this class was generated from the following file: