7 #include "../ColorPalettes.h"
34 size_t idx = (size_t)col;
35 xyzw_components.at(idx)->setText(
str.c_str());
36 highlightUnparsableEntries();
46 QTreeWidgetItem* currentItem) :
49 auto outerLayout =
new QHBoxLayout();
50 auto labelCol1 =
new QVBoxLayout();
51 auto labelCol2 =
new QVBoxLayout();
52 auto xzEdit =
new QVBoxLayout();
53 auto ywEdit =
new QVBoxLayout();
55 outerLayout->addLayout(labelCol1);
56 outerLayout->addLayout(xzEdit);
57 outerLayout->addLayout(labelCol2);
58 outerLayout->addLayout(ywEdit);
60 xyzw_components.reserve(4);
61 for (
size_t i = 0; i < 4; ++i)
63 xyzw_components.push_back(
new QLineEdit());
67 labelCol1->addWidget(
new QLabel(
"x"));
68 xzEdit->addWidget(xyzw_components.at(0));
70 labelCol2->addWidget(
new QLabel(
"z"));
71 ywEdit->addWidget(xyzw_components.at(2));
73 labelCol1->addWidget(
new QLabel(
"y"));
74 xzEdit->addWidget(xyzw_components.at(1));
76 labelCol2->addWidget(
new QLabel(
"w"));
77 ywEdit->addWidget(xyzw_components.at(3));
79 for (
const auto& el : xyzw_components)
82 connect(el, SIGNAL(editingFinished()),
this, SLOT(quaternionElementChanged())));
85 setLayout(outerLayout);
86 highlightUnparsableEntries();
90 QuaternionWidget::highlightUnparsableEntries()
93 for (
size_t i = 0; i < 4; ++i)
98 case armarx::aron::type::quaternion::FLOAT32:
104 case armarx::aron::type::quaternion::FLOAT64:
123 std::vector<unsigned char>
126 std::vector<unsigned char> res;
128 if (element_type == aron::type::quaternion::FLOAT32)
131 for (
size_t i = 0; i < 4; ++i)
134 NDArrayHelper::toByteVector<float>(xyzw_components.at(i)->text().toStdString());
136 res.insert(res.end(), bytevec.begin(), bytevec.end());
142 for (
size_t i = 0; i < 4; ++i)
144 auto bytevec = NDArrayHelper::toByteVector<double>(
145 xyzw_components.at(i)->text().toStdString());
147 res.insert(res.end(), bytevec.begin(), bytevec.end());
150 return (
success) ? res : std::vector<unsigned char>();
154 QuaternionWidget::quaternionElementChanged()
157 highlightUnparsableEntries();