1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Adrien Bruneton (CEA)
21 #include "PVViewer_ViewWindow.h"
22 #include "PVViewer_Core.h"
23 #include "PVViewer_ViewModel.h"
24 #include "PVViewer_GUIElements.h"
25 #include "PVViewer_ViewManager.h"
27 #include "SUIT_ViewManager.h"
28 #include "SUIT_ResourceMgr.h"
29 #include "SUIT_Session.h"
30 #include "SUIT_Desktop.h"
31 #include "SUIT_Application.h"
33 #include <pqTabbedMultiViewWidget.h>
34 #include <pqApplicationCore.h>
35 #include "pqActiveObjects.h"
38 \class PVViewer_ViewWindow
39 \brief PVGUI view window.
44 \param theDesktop parent desktop window
45 \param theModel view model
47 PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Viewer* theModel )
48 : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 )
50 myDesktop = theDesktop;
52 setViewManager(myModel->getViewManager());
53 // This may improve synchronization between PV3DViewer and PVViewer
54 // but this make the PVViewer not active when ParaVIS is launched,
55 // which results in a new RenderView being created when a dataset is displayed.
56 // So we comment it for now.
57 //pqActiveObjects::instance().setActiveView(nullptr);
58 myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
60 SUIT_Application* app = SUIT_Session::session()->activeApplication();
62 app->addPostRoutine(&PVViewer_ViewWindow::removePVMgr);
63 myPVMgr->setParent( this );
64 // This is mandatory, see setParent() method in Qt 4 documentation
66 setCentralWidget( myPVMgr );
68 PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(myDesktop);
69 pvge->setToolBarVisible(false);
71 qDebug("No multiViewManager defined");
76 As pqViewManager persists through the whole session,
77 the destructor first removes it from the children of this PVViewer_ViewWindow
78 to prevent its unexpected deletion.
80 PVViewer_ViewWindow::~PVViewer_ViewWindow()
84 PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(myDesktop);
85 pvge->setToolBarEnabled(false);
86 myPVMgr->setParent( 0 );
89 setCentralWidget( 0 );
93 void PVViewer_ViewWindow::removePVMgr()
95 pqTabbedMultiViewWidget* aPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
100 \brief Get the visual parameters of the view window.
101 \return visual parameters of this view window formatted to the string
103 QString PVViewer_ViewWindow::getVisualParameters()
105 return SUIT_ViewWindow::getVisualParameters();
109 \brief Restore visual parameters of the view window from the formated string
110 \param parameters view window visual parameters
112 void PVViewer_ViewWindow::setVisualParameters( const QString& parameters )
114 SUIT_ViewWindow::setVisualParameters( parameters );
118 \brief Returns the ParaView multi-view manager previously set with setMultiViewManager()
120 pqTabbedMultiViewWidget* PVViewer_ViewWindow::getMultiViewManager() const