36 this->selectedViewer = 0;
37 this->viewer = viewer;
38 this->viewerWidget = viewerWidget;
39 viewerWidget->setObjectName(
"0");
40 this->childrenCounter = 1;
41 this->leftSplitter =
new QSplitter(Qt::Orientation::Vertical,
this);
42 this->rightSplitter =
new QSplitter(Qt::Orientation::Vertical,
this);
43 this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
46 QObject::connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)),
this, SLOT(activeWidgetChanged(QWidget*, QWidget*)));
49 viewerWidget->setFocusPolicy(Qt::FocusPolicy::WheelFocus);
50 this->leftSplitter->addWidget(viewerWidget);
61 if (childrenCounter < 4)
63 QWidget* parent =
new QWidget();
64 clones.push_back(viewer->reproduce(parent));
65 parent->setObjectName(QString::fromStdString(
std::to_string(childrenCounter)));
66 parent->setFocusPolicy(Qt::FocusPolicy::WheelFocus);
67 cloneWidgets.push_back(parent);
69 if (childrenCounter == 0)
71 leftSplitter->addWidget(parent);
74 else if (childrenCounter == 1)
76 rightSplitter->addWidget(parent);
79 else if (childrenCounter == 2)
81 rightSplitter->addWidget(parent);
84 else if (childrenCounter == 3)
86 leftSplitter->addWidget(parent);
96 if (childrenCounter == 2)
98 if (rightSplitter->children().at(0))
100 cloneWidgets.pop_back();
102 rightSplitter->children().at(0)->~QObject();
107 else if (childrenCounter == 3)
109 if (rightSplitter->children().at(1))
111 cloneWidgets.pop_back();
113 rightSplitter->children().at(0)->~QObject();
118 else if (childrenCounter == 4)
120 if (leftSplitter->children().at(1))
122 cloneWidgets.pop_back();
124 leftSplitter->children().at(0)->~QObject();
129 if (selectedViewer == childrenCounter)
137 if (selectedViewer == 0)
139 viewer->setCamera(position, pointAtA, pointAtB);
145 clone->setCamera(position, pointAtA, pointAtB);
150 void RobotVisualizationWidget::activeWidgetChanged(QWidget* old, QWidget* now)
162 if (now == viewerWidget || (now->parentWidget() && now->parentWidget()->parentWidget() && now->parentWidget()->parentWidget()->parentWidget() && now->parentWidget()->parentWidget()->parentWidget() == viewerWidget))
167 for (QWidget* clone : cloneWidgets)
169 if (now == clone || (now->parentWidget() && now->parentWidget()->parentWidget() && now->parentWidget()->parentWidget()->parentWidget() && now->parentWidget()->parentWidget()->parentWidget() == clone))
171 this->selectedViewer = j;