Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CamiTK
Docs
Commits
2222b294
Commit
2222b294
authored
Nov 23, 2018
by
Jean-Loup Haberbusch
Browse files
UPDATED Qt Widget wizard
parent
2f20ff77
Pipeline
#15660
passed with stages
in 24 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docs/Getting Started/Examples and Tutorials/How_to_add_Qt_Widgets_as_additional_action_parameters_for_actions_created_using_the_CamiTK_wizard.md
View file @
2222b294
...
...
@@ -17,13 +17,11 @@ There are two main ways of getting this done.
The two options have their own pros and cons which will be discussed in
their respective sections.
## Prerequi
vi
sites
## Prerequisites
It is assumed that you already have a working knowledge about the use of
CamiTK for development purposes and that you know how to create an
action using the CamiTK wizard. If not, please come back after following
[
this tutorial
](
/Create_your_own_custom_action_for_CamiTK
"wikilink"
)
on
creating an action using the CamiTK wizard.
action using the CamiTK wizard.
## Learning by doing
...
...
@@ -46,12 +44,12 @@ To represent the output type we will use a combo box and populate it
with 6 enums (Same As Input,Char, Unsigned Char, Short, Unsigned Short,
Int and Unsigned Int).
[
center|
Combo box enums scalar type
](
/File:
List_box2.png
"wikilink"
)
!
[
Combo box enums scalar type
](
./assets/
List_box2.png
)
To represent the output sizes we will use three spin boxes with a
default value of 256.
[
center|
Spin boxes of ouptut size
](
/File:
Input_box.png
"wikilink"
)
!
[
Spin boxes of ouptut size
](
./assets/
Input_box.png
)
As you have already guessed, we can’t use CamiTK wizard to generate any
of these three Qt types (QComboBox, QEnum or QSpinBox). Hence we will
...
...
@@ -63,8 +61,7 @@ The following is the dock widget that belongs to the action. As you can
see, there are no input parameters created by the wizard since we didn’t
ask it to create any.
[
center|250px|Action overview with no
widget
](
/File:Resampling_action_overview_no_widget.png
"wikilink"
)

Let’s get started with creating our Qt widgets to set the input
parameters.
...
...
@@ -89,8 +86,7 @@ setProperty("Size X (nb of Voxels)", QVariant(256));
in the constructor of your action, which is in a file ResampleAction.cpp
for example. You don’t need to add things in the .h file. When you
compile then you have the result as shown at the end of the paragraph.
Your action constructor should look like this
:
Your action constructor should look like this :
```
c++
ResampleAction
::
ResampleAction
(
ActionExtension
*
extension
)
:
Action
(
extension
)
{
...
...
@@ -128,8 +124,6 @@ label of your widget.
-
Define a setter and a getter that will set and get the value of the
data member. This functions must be in the public part.
<!-- end list -->
```
c++
Enum_Scalar_Type
getScalarType
();
void
setScalarType
(
Enum_Scalar_Type
Scalar_Type
);
...
...
@@ -137,8 +131,6 @@ label of your widget.
-
Define the following QT Macros at the top of the class :
<!-- end list -->
```
c++
Q_OBJECT
Q_ENUMS
(
Enum_Scalar_Type
)
...
...
@@ -196,8 +188,7 @@ private:
The result you will have should look like this :
[
center | Result with Qt
properties
](
/File:Action_overview.png
"wikilink"
)

### How to get the user’s inputs ?
...
...
@@ -225,8 +216,6 @@ design Qt interface.
-
Find the
**getWidget()**
method. This method is called by the action
viewer to display the user interface.
<!-- end list -->
```
c++
QWidget
*
myAction
::
getWidget
()
{
return
NULL
;
...
...
@@ -241,8 +230,7 @@ viewer.
-
Open
**QtDesigner**
and create a new component inherited from the
QWidget class.
[
thumb | center |450px | Select **Widget** in the dialog
box
](
/File:create_action_7.png
"wikilink"
)

-
Save this file under a
**.ui**
extension file in your action project
folder. Note, in the source directory, not the build one.
...
...
docs/Getting Started/Examples and Tutorials/assets/Action_overview.png
0 → 100644
View file @
2222b294
52.5 KB
docs/Getting Started/Examples and Tutorials/assets/Create_action_7.png
0 → 100644
View file @
2222b294
39.2 KB
docs/Getting Started/Examples and Tutorials/assets/Input_box.png
0 → 100644
View file @
2222b294
13.4 KB
docs/Getting Started/Examples and Tutorials/assets/List_box2.png
0 → 100644
View file @
2222b294
16.2 KB
docs/Getting Started/Examples and Tutorials/assets/Resampling_action_overview_no_widget.png
0 → 100644
View file @
2222b294
29.8 KB
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment