Skip to content
Snippets Groups Projects
Commit 4495fc75 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Add WidgetDescription::LabeledWidget

parent 2acf6ce6
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,13 @@ module armarx
sequence<Widget> WidgetSeq;
dictionary<string,Widget> StringWidgetDictionary;
class LabeledWidget
{
string label;
Widget w;
};
sequence<LabeledWidget> LabeledWidgetSeq;
//Layouts
class HBoxLayout extends Widget
{
......
......@@ -46,6 +46,7 @@ namespace armarx
FloatRange rangeRoll = { -M_PI, M_PI},
FloatRange rangePitch = { -M_PI, M_PI},
FloatRange rangeYaw = { -M_PI, M_PI});
inline HBoxLayoutPtr makeXYZRollPitchYawWidget(
const std::string& namePrefix,
FloatRange rangeLin,
......@@ -53,6 +54,14 @@ namespace armarx
{
return makeXYZRollPitchYawWidget(namePrefix, 0, 0, 0, 0, 0, 0, rangeLin, rangeLin, rangeLin, rangeAng, rangeAng, rangeAng);
}
inline LabeledWidgetPtr makeLabeledWidget(std::string name, WidgetPtr widget)
{
LabeledWidgetPtr w = new LabeledWidget;
w->label = std::move(name);
w->w = std::move(widget);
return w;
}
}
}
......
......@@ -114,6 +114,23 @@ namespace armarx
};
DescribedWidgetFactoryRegistration<DescribedFormLayout> registerDescribedFormLayout {FormLayout::ice_staticId()};
class DescribedLabeledWidget : public DescribedWidgetLayoutBase
{
public:
DescribedLabeledWidget(const WidgetPtr& p, ValueChangedListenerInterface* listener)
: DescribedWidgetLayoutBase(listener)
{
LabeledWidgetPtr ptr = LabeledWidgetPtr::dynamicCast(p);
ARMARX_CHECK_EXPRESSION(ptr);
auto l = new QHBoxLayout;
setLayout(l);
layout()->setContentsMargins(0, 0, 0, 0);
l->addWidget(new QLabel {QString::fromStdString(ptr->label)});
addChild(ptr->w);
l->addWidget(children.back());
}
};
DescribedWidgetFactoryRegistration<DescribedLabeledWidget> registerDescribedLabeledWidget {LabeledWidget::ice_staticId()};
//static elements
class DescribedHSpacer : public DescribedWidgetBase
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment