36 #include <QStandardItemModel> 41 const QStandardItemModel* model = qobject_cast<
const QStandardItemModel*>(w->model());
42 for (
unsigned int i=0; i < 3; ++i) {
43 QStandardItem* item = model->item(i);
45 item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
46 if (w->currentIndex() ==
static_cast<int>(axis)) w->setCurrentIndex((axis+1) % 3);
48 item->setFlags(item->flags() | Qt::ItemIsEnabled);
56 qRegisterMetaType<Eigen::Quaterniond>(
"Eigen::Quaterniond");
59 ui_->a1->setCurrentIndex(0);
63 q_ = Eigen::Quaterniond::Identity();
67 connect(
ui_->a1, SIGNAL(currentIndexChanged(
int)),
69 connect(
ui_->a2, SIGNAL(currentIndexChanged(
int)),
71 connect(
ui_->a3, SIGNAL(currentIndexChanged(
int)),
84 a[0] =
ui_->a1->currentIndex();
85 a[1] =
ui_->a2->currentIndex();
86 a[2] =
ui_->a3->currentIndex();
97 bool bFirstCall = !this->signalsBlocked();
98 this->blockSignals(
true);
101 QComboBox* origin =
dynamic_cast<QComboBox*
>(sender());
107 this->blockSignals(
false);
110 ui_->a2->currentIndex(),
111 ui_->a3->currentIndex());
122 Eigen::Quaterniond q =
123 Eigen::AngleAxisd(e1, Eigen::Vector3d::Unit(a[0])) *
124 Eigen::AngleAxisd(e2, Eigen::Vector3d::Unit(a[1])) *
125 Eigen::AngleAxisd(e3, Eigen::Vector3d::Unit(a[2]));
130 ui_->e1->blockSignals(
true);
131 ui_->e2->blockSignals(
true);
132 ui_->e3->blockSignals(
true);
138 ui_->e1->blockSignals(
false);
139 ui_->e2->blockSignals(
false);
140 ui_->e3->blockSignals(
false);
142 if (
q_.isApprox(q))
return;
150 if (a1 > 2 || a2 > 2 || a3 > 2)
return;
151 if (static_cast<int>(a1) ==
ui_->a1->currentIndex() &&
152 static_cast<int>(a2) ==
ui_->a2->currentIndex() &&
153 static_cast<int>(a3) ==
ui_->a3->currentIndex())
return;
155 this->blockSignals(
true);
156 ui_->a3->setCurrentIndex(a3);
157 ui_->a2->setCurrentIndex(a2);
158 ui_->a1->setCurrentIndex(a1);
159 this->blockSignals(
false);
167 if (
q_.isApprox(q))
return;
181 Eigen::Vector3d e =
q_.matrix().eulerAngles(a[0], a[1], a[2]);
static double from_degrees(double degrees)
static double to_degrees(double radians)