From 871d1615e8395c05a68881a5c59416233cd93146 Mon Sep 17 00:00:00 2001 From: ribes Date: Wed, 19 Jan 2011 14:24:13 +0000 Subject: [PATCH] Use the new GUI C++ interface for embedding a Qt widget on SALOME central widget --- src/wrappers/BL_MainWindows_SALOME.cxx | 22 ++++++++++++++++------ src/wrappers/BL_MainWindows_SALOME.hxx | 18 +++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/wrappers/BL_MainWindows_SALOME.cxx b/src/wrappers/BL_MainWindows_SALOME.cxx index ccedfe5..6913118 100644 --- a/src/wrappers/BL_MainWindows_SALOME.cxx +++ b/src/wrappers/BL_MainWindows_SALOME.cxx @@ -25,6 +25,7 @@ BL::MainWindows_SALOME::MainWindows_SALOME(const QString & module_name) : DEBTRACE("Creating BL::MainWindows_SALOME"); _actionId = 190; _currentViewId = -1; + _svm = 0; } void @@ -40,12 +41,20 @@ void BL::MainWindows_SALOME::createView() { DEBTRACE("BL::MainWindows_SALOME CreateView"); - _svm = new SUIT_ViewManager(_appli->activeStudy(), _appli->desktop(), new SUIT_ViewModel()); - _appli->addViewManager(_svm); - _viewWin = _svm->createViewWindow(); + QString vmType = "JobManager View"; + + // Get JobManager View Manager + _svm = _appli->getViewManager( vmType, true ); + if (!_svm) { + // view manager not found + QTextEdit* w = new QTextEdit; + _svm = _appli->createViewManager( vmType, w ); + } + + // Create a view + _viewWin = _svm->getActiveView(); + _viewWin->setClosable( false ); _currentViewId = _viewWin->getId(); - if (_viewWin && _appli->desktop()) - _viewWin->resize((int)(_appli->desktop()->width() * 0.6), (int)(_appli->desktop()->height() * 0.6 )); DEBTRACE("End of BL::MainWindows_SALOME CreateView"); } @@ -84,7 +93,8 @@ void BL::MainWindows_SALOME::viewManagers(QStringList& list) const { DEBTRACE("Entering in BL::SalomeGui::viewManagers"); - list.append(_svm->getType()); + if (_svm) + list.append(_svm->getType()); } diff --git a/src/wrappers/BL_MainWindows_SALOME.hxx b/src/wrappers/BL_MainWindows_SALOME.hxx index 627c20d..4c73f29 100644 --- a/src/wrappers/BL_MainWindows_SALOME.hxx +++ b/src/wrappers/BL_MainWindows_SALOME.hxx @@ -33,7 +33,7 @@ namespace BL { class MainWindows_SALOME : virtual public MainWindows_Wrap, - virtual public SalomeApp_Module + virtual public SalomeApp_Module { public: MainWindows_SALOME(const QString & module_name); @@ -50,14 +50,14 @@ namespace BL virtual QMainWindow * getTabParent(); virtual QAction* createAction(const QString& toolTip, - const QIcon& icon, - const QString& menu, - const QString& status, - const int shortCut, - QObject* parent =0, - bool checkable = false, - QObject* receiver =0, - const char* member =0); + const QIcon& icon, + const QString& menu, + const QString& status, + const int shortCut, + QObject* parent =0, + bool checkable = false, + QObject* receiver =0, + const char* member =0); virtual int createTopMenu(const QString & menu_name); virtual void addActionToMenu(QAction * action, int menu_id); -- 2.39.2