7 #include "../../ColorPalettes.h"
33 size_t idx = (size_t)col;
34 xyzw_components.at(idx)->setText(
str.c_str());
35 highlightUnparsableEntries();
45 QTreeWidgetItem* currentItem) :
48 auto outerLayout =
new QHBoxLayout();
49 auto labelCol1 =
new QVBoxLayout();
50 auto labelCol2 =
new QVBoxLayout();
51 auto xzEdit =
new QVBoxLayout();
52 auto ywEdit =
new QVBoxLayout();
54 outerLayout->addLayout(labelCol1);
55 outerLayout->addLayout(xzEdit);
56 outerLayout->addLayout(labelCol2);
57 outerLayout->addLayout(ywEdit);
59 xyzw_components.reserve(4);
60 for (
size_t i = 0; i < 4; ++i)
62 xyzw_components.push_back(
new QLineEdit());
66 labelCol1->addWidget(
new QLabel(
"x"));
67 xzEdit->addWidget(xyzw_components.at(0));
69 labelCol2->addWidget(
new QLabel(
"z"));
70 ywEdit->addWidget(xyzw_components.at(2));
72 labelCol1->addWidget(
new QLabel(
"y"));
73 xzEdit->addWidget(xyzw_components.at(1));
75 labelCol2->addWidget(
new QLabel(
"w"));
76 ywEdit->addWidget(xyzw_components.at(3));
78 for (
const auto& el : xyzw_components)
81 connect(el, SIGNAL(editingFinished()),
this, SLOT(quaternionElementChanged())));
84 setLayout(outerLayout);
85 highlightUnparsableEntries();
89 QuaternionWidget::highlightUnparsableEntries()
92 for (
size_t i = 0; i < 4; ++i)
97 case armarx::aron::type::quaternion::FLOAT32:
103 case armarx::aron::type::quaternion::FLOAT64:
122 std::vector<unsigned char>
125 std::vector<unsigned char> res;
127 if (element_type == aron::type::quaternion::FLOAT32)
130 for (
size_t i = 0; i < 4; ++i)
133 NDArrayHelper::toByteVector<float>(xyzw_components.at(i)->text().toStdString());
135 res.insert(res.end(), bytevec.begin(), bytevec.end());
141 for (
size_t i = 0; i < 4; ++i)
143 auto bytevec = NDArrayHelper::toByteVector<double>(
144 xyzw_components.at(i)->text().toStdString());
146 res.insert(res.end(), bytevec.begin(), bytevec.end());
149 return (
success) ? res : std::vector<unsigned char>();
153 QuaternionWidget::quaternionElementChanged()
156 highlightUnparsableEntries();