From 8008768120df6c16b1b2c063cdd8d635016629b7 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Tue, 13 Feb 2018 11:41:04 +0100 Subject: [PATCH] OSGWidget are created as dock widget. * There is no central widget anymore. This makes the GUI more flexible. --- include/gepetto/gui/mainwindow.hh | 4 +++- src/gui/mainwindow.cc | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/gepetto/gui/mainwindow.hh b/include/gepetto/gui/mainwindow.hh index 5b40a5f..771294c 100644 --- a/include/gepetto/gui/mainwindow.hh +++ b/include/gepetto/gui/mainwindow.hh @@ -8,6 +8,7 @@ #include <QLabel> #include <gepetto/viewer/group-node.h> +#include <gepetto/viewer/corba/deprecated.hh> #include <gepetto/gui/fwd.hh> @@ -70,7 +71,8 @@ namespace gepetto { } /// Get the central widget. - OSGWidget* centralWidget() const; + /// \deprecated Use \ref osgWindows instead + OSGWidget* centralWidget() const GEPETTO_VIEWER_CORBA_DEPRECATED; /// Get the list of windows. QList <OSGWidget*> osgWindows () const; diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index 54d6769..495d9b8 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -242,15 +242,14 @@ namespace gepetto { void MainWindow::addOSGWidget(OSGWidget* osgWidget) { - if (!osgWindows_.empty()) { - QDockWidget* dockOSG = new QDockWidget ( - tr("OSG Viewer") + " " + QString::number (osgWindows_.size()), this); - dockOSG->setWidget(osgWidget); - addDockWidget(Qt::RightDockWidgetArea, dockOSG); - } else { + QDockWidget* dockOSG = new QDockWidget ( + tr("Window ") + osgWidget->objectName(), this); + dockOSG->setWidget(osgWidget); + addDockWidget(Qt::RightDockWidgetArea, dockOSG); + if (osgWindows_.empty()) { // This OSGWidget should be the central view centralWidget_ = osgWidget; - setCentralWidget(centralWidget_); + setCentralWidget(0); #if GEPETTO_GUI_HAS_PYTHONQT pythonWidget_->addToContext("osg", centralWidget_); #endif -- GitLab