Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ set(MOC_HEADER_FILES
${SRC_ROOT}/SofaVideoRecorderManager.h
${SRC_ROOT}/SofaPluginManager.h
${SRC_ROOT}/SofaSceneGraphWidget.h
${SRC_ROOT}/WDoubleLineEdit.h
${SRC_ROOT}/WDoubleLineEdit.h
${SRC_ROOT}/dockwidgets/InspectorDock.h
${SRC_ROOT}/datawidgets/OptionsGroupWidget.h
${SRC_ROOT}/datawidgets/SelectableItemWidget.h
)
Expand Down Expand Up @@ -245,6 +246,7 @@ set(SOURCE_FILES
${SRC_ROOT}/SofaSceneGraphWidget.cpp
${SRC_ROOT}/viewer/VisualModelPolicy.cpp
${SRC_ROOT}/QtDataRepository.cpp
${SRC_ROOT}/dockwidgets/InspectorDock.cpp
${SRC_ROOT}/datawidgets/OptionsGroupWidget.cpp
${SRC_ROOT}/datawidgets/SelectableItemWidget.cpp
)
Expand All @@ -257,6 +259,8 @@ set(UI_FILES
${SRC_ROOT}/PluginManager.ui
${SRC_ROOT}/ViewerShortcuts.ui
${SRC_ROOT}/VideoRecorderManager.ui
${SRC_ROOT}/dockwidgets/InspectorDock.ui

)
set(QRC_FILES
${SRC_ROOT}/resources/RealGUI.qrc
Expand Down
40 changes: 33 additions & 7 deletions src/sofa/qt/GUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="actionControls"/>
<addaction name="actionInspector"/>
<addaction name="separator"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="helpMenu">
<property name="title">
Expand Down Expand Up @@ -154,11 +158,17 @@
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>400</height>
</size>
</property>
<layout class="QVBoxLayout" name="_13">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
Expand Down Expand Up @@ -657,9 +667,6 @@ State 2: dirty, in that state the button reflect the fact that the scene graph v
<property name="title">
<string>Show node</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand All @@ -686,9 +693,6 @@ State 2: dirty, in that state the button reflect the fact that the scene graph v
<property name="title">
<string>Show object</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -939,6 +943,28 @@ State 2: dirty, in that state the button reflect the fact that the scene graph v
<string>Viewer's shortcuts</string>
</property>
</action>
<action name="actionInspector">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Inspector</string>
</property>
</action>
<action name="actionControls">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Controls</string>
</property>
</action>
</widget>
<layoutdefault spacing="2" margin="5"/>
<includes>
Expand Down
3 changes: 0 additions & 3 deletions src/sofa/qt/QDisplayDataWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,6 @@ bool QDataSimpleEdit::createWidgets()
layout->addWidget(innerWidget_.widget.lineEdit);
}




return true;
}

Expand Down
42 changes: 39 additions & 3 deletions src/sofa/qt/RealGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "SofaWindowDataGraph.h"
#endif

#include <QStyleHints>
#include "dockwidgets/InspectorDock.h"

#include <mutex>
#include <QScreen>
Expand Down Expand Up @@ -158,7 +160,6 @@ class QSOFAApplication : public QApplication
QCoreApplication::setOrganizationName("Sofa Consortium");
QCoreApplication::setOrganizationDomain("sofa");
QCoreApplication::setApplicationName("runSofa");

setStyle();
}

Expand Down Expand Up @@ -283,6 +284,7 @@ void RealGUI::CreateApplication(int /*_argc*/, char** /*_argv*/)
*argc = 1;
argv[0] = strdup ( BaseGUI::GetProgramName() );
argv[1]=nullptr;

application = new QSOFAApplication ( *argc,argv );

//force locale to Standard C
Expand Down Expand Up @@ -361,7 +363,10 @@ RealGUI::RealGUI ( const char* viewername)
m_viewerMSAANbSampling(1)
{
setupUi(this);


m_inspectorDock = new InspectorDock(this);
addDockWidget(Qt::RightDockWidgetArea, m_inspectorDock);

ExpandAllButton->setIcon(QIcon(":/RealGUI/expandAll"));
CollapseAllButton->setIcon(QIcon(":/RealGUI/collapseAll"));
sceneGraphRefreshToggleButton->setIcon(QIcon(":/RealGUI/sceneGraphRefresh"));
Expand Down Expand Up @@ -470,6 +475,31 @@ RealGUI::RealGUI ( const char* viewername)
connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(showAbout()));

m_filelistener = new RealGUIFileListener(this);

// Replace the menu's actions by the one generated from the docks.
auto action = m_inspectorDock->toggleViewAction();
action->setText(actionInspector->text());
View->insertAction(actionInspector, action);
View->removeAction(actionInspector);
actionInspector = action;

action = dockWidget->toggleViewAction();
action->setText(actionControls->text());
View->insertAction(actionControls, action);
View->removeAction(actionControls);
actionControls = action;

connect(actionViewerShowDocumentation, &QAction::triggered, this, [this](bool){
QDialog* dialog=new QDialog();
auto tmp = new Ui::windowViewerShortcuts();
tmp->setupUi(dialog);
sofa::qt::viewer::SofaViewer* sofaViewer = dynamic_cast<sofa::qt::viewer::SofaViewer*>(getViewer());
if(sofaViewer)
tmp->content->setText(sofaViewer->helpString());
else
tmp->content->setText("There is no documentation for this viewer");
dialog->open();
});
}

//------------------------------------
Expand Down Expand Up @@ -778,6 +808,7 @@ void RealGUI::setSceneWithoutMonitor (Node::SPtr root, const char* filename, boo
simulationGraph->resizeColumnToContents(0);
statWidget->CreateStats(root.get());

m_inspectorDock->setCurrentSelection({root});
getViewer()->setScene( root, filename );
getViewer()->load();
getViewer()->resetView();
Expand Down Expand Up @@ -817,6 +848,9 @@ void RealGUI::unloadScene(bool _withViewer)

if(_withViewer && getViewer())
getViewer()->setScene(nullptr);

m_inspectorDock->setCurrentSelection({});
getViewer()->setCurrentSelection({});
}

//------------------------------------
Expand Down Expand Up @@ -1622,7 +1656,9 @@ void RealGUI::createSimulationGraph()
if(m_enableInteraction)
{
connect(simulationGraph, &QSofaListView::itemSelectionChanged, this, [this](){
getViewer()->setCurrentSelection(simulationGraph->getCurrentSelectedBases());
auto selectedItems = simulationGraph->getCurrentSelectedBases();
getViewer()->setCurrentSelection(selectedItems);
m_inspectorDock->setCurrentSelection(selectedItems);
});
}else
{
Expand Down
4 changes: 4 additions & 0 deletions src/sofa/qt/RealGUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@

#include <ui_GUI.h>
#include <ui_ViewerShortcuts.h>
#include <ui_InspectorDock.h>
#include "GraphListenerQListView.h"
#include "QMenuFilesRecentlyOpened.h"
#include "AboutSOFADialog.h"
#include "PickHandlerCallBacks.h"
#include "sofa/qt/dockwidgets/InspectorDock.h"

#include <sofa/gui/common/BaseGUI.h>
#include <sofa/gui/common/ViewerFactory.h>
Expand Down Expand Up @@ -172,6 +174,8 @@ class SOFA_QT_API RealGUI : public QMainWindow, public Ui::GUI, public sofa::gui
std::map< helper::SofaViewerFactory::Key, QAction* > viewerMap;
InformationOnPickCallBack informationOnPickCallBack;

InspectorDock* m_inspectorDock;

QWidget* currentTab;
QSofaStatWidget* statWidget;
QTimer* timerStep;
Expand Down
Loading
Loading