9 #include "../ColorPalettes.h"
36 size_t idx = (size_t)col;
37 xyzw_components.at(idx)->setText(
str.c_str());
38 highlightUnparsableEntries();
48 QTreeWidgetItem* currentItem) :
51 auto outerLayout =
new QHBoxLayout();
52 auto labelCol1 =
new QVBoxLayout();
53 auto labelCol2 =
new QVBoxLayout();
54 auto xzEdit =
new QVBoxLayout();
55 auto ywEdit =
new QVBoxLayout();
57 outerLayout->addLayout(labelCol1);
58 outerLayout->addLayout(xzEdit);
59 outerLayout->addLayout(labelCol2);
60 outerLayout->addLayout(ywEdit);
62 xyzw_components.reserve(4);
63 for (
size_t i = 0; i < 4; ++i)
65 xyzw_components.push_back(
new QLineEdit());
69 labelCol1->addWidget(
new QLabel(
"x"));
70 xzEdit->addWidget(xyzw_components.at(0));
72 labelCol2->addWidget(
new QLabel(
"z"));
73 ywEdit->addWidget(xyzw_components.at(2));
75 labelCol1->addWidget(
new QLabel(
"y"));
76 xzEdit->addWidget(xyzw_components.at(1));
78 labelCol2->addWidget(
new QLabel(
"w"));
79 ywEdit->addWidget(xyzw_components.at(3));
81 for (
const auto& el : xyzw_components)
84 connect(el, SIGNAL(editingFinished()),
this, SLOT(quaternionElementChanged())));
87 setLayout(outerLayout);
88 highlightUnparsableEntries();
92 QuaternionWidget::highlightUnparsableEntries()
95 for (
size_t i = 0; i < 4; ++i)
100 case armarx::aron::type::quaternion::FLOAT32:
106 case armarx::aron::type::quaternion::FLOAT64:
125 std::vector<unsigned char>
128 std::vector<unsigned char> res;
130 if (element_type == aron::type::quaternion::FLOAT32)
133 for (
size_t i = 0; i < 4; ++i)
136 NDArrayHelper::toByteVector<float>(xyzw_components.at(i)->text().toStdString());
138 res.insert(res.end(), bytevec.begin(), bytevec.end());
144 for (
size_t i = 0; i < 4; ++i)
146 auto bytevec = NDArrayHelper::toByteVector<double>(
147 xyzw_components.at(i)->text().toStdString());
149 res.insert(res.end(), bytevec.begin(), bytevec.end());
152 return (
success) ? res : std::vector<unsigned char>();
156 QuaternionWidget::quaternionElementChanged()
159 highlightUnparsableEntries();