CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkWorkflowWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkWorkflowWidget_h
22#define __ctkWorkflowWidget_h
23
24// Qt includes
25#include <QWidget>
26#include <QVariant>
27class QAbstractButton;
28
29// CTK includes
30#include "ctkPimpl.h"
31#include "ctkWidgetsExport.h"
32class ctkWorkflow;
33class ctkWorkflowStep;
37
38class ctkWorkflowWidgetPrivate;
39
44class CTK_WIDGETS_EXPORT ctkWorkflowWidget : public QWidget
45{
46 Q_OBJECT
47 Q_PROPERTY(bool showButtonBoxWidget READ showButtonBoxWidget WRITE setShowButtonBoxWidget)
48public:
49
50 typedef QWidget Superclass;
51 explicit ctkWorkflowWidget(QWidget* parent = 0);
53
55 Q_INVOKABLE virtual ctkWorkflow* workflow()const;
56 Q_INVOKABLE virtual void setWorkflow(ctkWorkflow* newWorkflow);
57
58 Q_INVOKABLE ctkWorkflowWidgetStep* widgetStep(const QString& id)const;
59
62 Q_INVOKABLE virtual ctkWorkflowGroupBox* workflowGroupBox()const;
63
66 void setShowButtonBoxWidget(bool newShowButtonBoxWidget);
67
70
94 static void formatButton(QAbstractButton* button, const QString& format, ctkWorkflowWidgetStep* step);
97 static QString formatText(const QString& format, ctkWorkflowWidgetStep* step);
98
99public Q_SLOTS:
102 virtual void onCurrentStepChanged(ctkWorkflowStep* currentStep);
103
104protected Q_SLOTS:
106
107protected:
108
109 // Triggers updates of the workflowGroupBox when the current workflow step has changed.
110 virtual void updateStepUI(ctkWorkflowStep* currentStep);
111
112 // Triggers updates of the buttonBoxWidget when the current workflow step has changed.
114
117 static QVariant buttonItem(QString formatItem, ctkWorkflowWidgetStep* step);
120 static QMap<QString, QVariant> parse(const QString& format, ctkWorkflowWidgetStep* step);
121
122protected:
123 QScopedPointer<ctkWorkflowWidgetPrivate> d_ptr;
124
125private:
126 Q_DECLARE_PRIVATE(ctkWorkflowWidget);
127 Q_DISABLE_COPY(ctkWorkflowWidget);
128
129};
130
131#endif
132
A widget that controls a workflow.
ctkWorkflowGroupBox is a widget displaying the user interface elements, title, description and/or err...
ctkWorkflowStep is the basis for a workflow step.
ctkWorkflowWidgetStep is a convienience class to quickly construct a ctkWorkflowStep with a user inte...
ctkWorkflowWidget is the basis for a workflow with a user interface. It groups together and manages a...
virtual ~ctkWorkflowWidget()
void setShowButtonBoxWidget(bool newShowButtonBoxWidget)
Q_INVOKABLE ctkWorkflowWidgetStep * widgetStep(const QString &id) const
static void formatButton(QAbstractButton *button, const QString &format, ctkWorkflowWidgetStep *step)
virtual void onCurrentStepChanged(ctkWorkflowStep *currentStep)
Q_INVOKABLE ctkWorkflowButtonBoxWidget * buttonBoxWidget() const
Get the widget with the 'next', 'back' and 'goTo' buttons.
void onStepRegistered(ctkWorkflowStep *step)
static QString formatText(const QString &format, ctkWorkflowWidgetStep *step)
virtual Q_INVOKABLE ctkWorkflow * workflow() const
Set/get the workflow associated with this widget.
static QVariant buttonItem(QString formatItem, ctkWorkflowWidgetStep *step)
static QMap< QString, QVariant > parse(const QString &format, ctkWorkflowWidgetStep *step)
void updateButtonBoxUI(ctkWorkflowStep *currentStep)
ctkWorkflowWidget(QWidget *parent=0)
virtual Q_INVOKABLE ctkWorkflowGroupBox * workflowGroupBox() const
QScopedPointer< ctkWorkflowWidgetPrivate > d_ptr
bool showButtonBoxWidget() const
Set/get whether or not to associate a buttonBoxWidget with this step (default true)
virtual void updateStepUI(ctkWorkflowStep *currentStep)
virtual Q_INVOKABLE void setWorkflow(ctkWorkflow *newWorkflow)
ctkWorkflow is the basis for a workflow engine, i.e. a state machine with enhancements to support ctk...
Definition ctkWorkflow.h:40