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

ADDED Qt Widget CamiTK CEP

parent 2222b294
Pipeline #15661 passed with stages
in 24 seconds
You might need to add some Qt Widget to your CamiTK action. You can
choose to
- add parameters as shown [this page](
- add your own Qt widgets created using the Qt designer as shown [this page](
- mix the default CamiTK action widget with your own widget. That’s
what you will learn with this topic.
## How is built the default action widget ?
The default action widget is a QWidget . This widget contains a QLayout.
This layout contains three objects:
- The first object (indice 0) is the name of the action.
- The second object (indice 1) contains the panel containing the
action’s properties (“Description”, “target” and “parameters”).
- The third object (indice 2) is the panel containing the two buttons
“Apply” and “Revert”.
You can insert your own widget in this layout at one of the previous
## Create your widget
You can create your widget using the Qt Designer or simply by using Qt
objects. For example, create a new QPushButton:
QPushButton *yourButton = new QPushButton("The text of your button");
QObject::connect(saveButton, SIGNAL(released()), this, SLOT(your_callback()));
## Add your widget in the default action widget
And then add your widget in the default widget, ie add your widget in
the default action widget layout:
QLayout *informationFrameLayout = Action::getWidget()->layout();
informationFrameLayout->addWidget(yourButton); // add the widget at the end of the layout
You can also declare the action widget as a member of your action class,
and instanciate it as the default action widget:
myWidget = new ActionWidget(this);
And then you get the layout of the widget to insert your own widget in
QBoxLayout * informationFrameLayout = dynamic_cast<QBoxLayout*>(myWidget->layout());
informationFrameLayout->insertWidget(0, yourButton); // insert the widget at the given index
You might also need to hide the default buttons
ActionWidget *actionWidget = dynamic_cast<ActionWidget * >(this->actionWidget);
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