From 5e2e560a41de6921538a5c5e81ada14ac70926f1 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 14 Sep 2017 14:02:28 +0300 Subject: [PATCH] Fix for '23472: [CEA 2164] Display problem when ParaView isn't the first viewer' issue. --- src/PVViewer/PVViewer_Behaviors.cxx | 5 ++-- src/Session/SALOME_Session_Server.cxx | 36 ++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/PVViewer/PVViewer_Behaviors.cxx b/src/PVViewer/PVViewer_Behaviors.cxx index d61892187..ddaae388f 100644 --- a/src/PVViewer/PVViewer_Behaviors.cxx +++ b/src/PVViewer/PVViewer_Behaviors.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -111,7 +110,9 @@ void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk) new pqAutoLoadPluginXMLBehavior(this); // auto load plugins GUI stuff new pqPluginDockWidgetsBehavior(desk); new pqPluginActionGroupBehavior(desk); - new pqPersistentMainWindowStateBehavior(desk); + // rnv: Disable ParaView main window persistance mechanism, + // because SALOME has own functionality for store/restore windows state. + // new pqPersistentMainWindowStateBehavior(desk); new pqObjectPickingBehavior(desk); new pqCollaborationBehavior(this); new pqViewStreamingBehavior(this); diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index ea144e9a9..c39d700e0 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -371,12 +371,36 @@ int main( int argc, char **argv ) } #if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) - // initialization of the X11 visual on Linux - QSurfaceFormat format; - format.setDepthBufferSize(16); - format.setStencilBufferSize(1); - format.setProfile(QSurfaceFormat::CompatibilityProfile); - QSurfaceFormat::setDefaultFormat(format); + + // RNV: setup the default format: + // QSurfaceFormat should be set before creation of QApplication, + // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats + // (see comments below) and set the resultant format here. + + // Settings from Paraview: + // This piece of code was taken from QVTKOpenGLWidget::defaultFormat() method in + // order to avoid dependency of the SALOME_Session_Server on vtk libraries + QSurfaceFormat fmt; + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setVersion(3, 2); + fmt.setProfile(QSurfaceFormat::CoreProfile); + fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer); + fmt.setRedBufferSize(1); + fmt.setGreenBufferSize(1); + fmt.setBlueBufferSize(1); + fmt.setDepthBufferSize(1); + fmt.setStencilBufferSize(0); + fmt.setAlphaBufferSize(1); + fmt.setStereo(false); + fmt.setSamples(0); + + // Settings for OCCT viewer window: + fmt.setDepthBufferSize(16); + fmt.setStencilBufferSize(1); + // fmt.setProfile(QSurfaceFormat::CompatibilityProfile); + + QSurfaceFormat::setDefaultFormat(fmt); + #endif // Create Qt application instance; -- 2.39.2