]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Use the new GUI C++ interface for embedding a Qt widget on SALOME central widget
authorribes <ribes>
Wed, 19 Jan 2011 14:24:13 +0000 (14:24 +0000)
committerribes <ribes>
Wed, 19 Jan 2011 14:24:13 +0000 (14:24 +0000)
src/wrappers/BL_MainWindows_SALOME.cxx
src/wrappers/BL_MainWindows_SALOME.hxx

index ccedfe5ec1c325fa9793699e275072f7967f65dd..691311800849d8c2b219063bfbf2e5f1a98e8ace 100644 (file)
@@ -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());
 }
 
 
index 627c20d22d5e9dd324b7164a78da2ad58ee3af9d..4c73f29c0f52aaee2cf52a958df2f5e6cdb62bba 100644 (file)
@@ -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);