Commit 2222b294 authored by Jean-Loup Haberbusch's avatar Jean-Loup Haberbusch
Browse files

UPDATED Qt Widget wizard

parent 2f20ff77
Pipeline #15660 passed with stages
in 24 seconds
......@@ -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.
## Prerequivisites
## 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")
![Action overview with no widget](./assets/Resampling_action_overview_no_widget.png)
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")
![Result with Qt properties](./assets/Action_overview.png)
### 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")
![Select **Widget** in the dialog box](./assets/Create_action_7.png)
- Save this file under a **.ui** extension file in your action project
folder. Note, in the source directory, not the build one.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment