diff --git a/sdk/applications/imp/ImpMainWindow.cpp b/sdk/applications/imp/ImpMainWindow.cpp index 0600efba4fab80e8c3f76dae6e3c972bf4f98de8..6eccc8d05818536f92e8d1919a4a95f5b608bd28 100644 --- a/sdk/applications/imp/ImpMainWindow.cpp +++ b/sdk/applications/imp/ImpMainWindow.cpp @@ -499,22 +499,13 @@ void ImpMainWindow::updateViewMenu() { // change the central viewer if there is more than one viewer in the central area if (qobject_cast(centralWidget())->count() > 1) { viewMenu->addSeparator()->setText(tr("Toggle Central Viewers")); -// for(Viewer *v : viewers) { -// int i = 0; -// // beware that getWidget(..) requires a parent and as the widget was setup inside centralWidget() -// // it was reparented to centralWidget() → use getWidget(centralWidget()) and not getWidget(this) -// // in order not to modify the central widget parenting -// while (i(centralWidget())->count() && qobject_cast(centralWidget())->widget(i)!=v->getWidget(centralWidget())) -// i++; -// if (i(centralWidget())->count()) { -// viewMenu->addAction(v->objectName()); -// } -// } - - // add a toggle action + + // add a toggle action for each widget stacked inside the central widget for (int i = 0; i < qobject_cast(centralWidget())->count(); i++) { QWidget* cWidget = qobject_cast(centralWidget())->widget(i); - // get the viewer associated with the widget in the central area + // Get the viewer associated with the widget in the central area + // As there is no map from widget to viewer, we need to find the viewer that + // has the given corresponding widget. // Beware that getWidget(..) requires a parent and as the widget was setup inside centralWidget() // it was reparented to centralWidget() → use getWidget(centralWidget()) and not getWidget(this) // in order not to modify the central widget parenting