]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
21948: EDF SMESH : Memory is not freed when deleting a mesh
authoreap <eap@opencascade.com>
Fri, 14 Dec 2012 13:49:42 +0000 (13:49 +0000)
committereap <eap@opencascade.com>
Fri, 14 Dec 2012 13:49:42 +0000 (13:49 +0000)
   Show nb of nodes and elements in "Compute" dialog

src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h

index 9cc3ac5d5f2b6456ccaa87d013519dd5a0fba352..5a36d03018412ae85ec4e2750445a1c147111d20 100644 (file)
@@ -721,24 +721,43 @@ void SMESHGUI_ComputeDlg_QThread::cancel()
 //================================================================================
 //================================================================================
 
-SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
-                                                                       SMESH::SMESH_Gen_var gen,
+SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget             * parent,
+                                                                       SMESH::SMESH_Gen_var  gen,
                                                                        SMESH::SMESH_Mesh_var mesh,
                                                                        GEOM::GEOM_Object_var mainShape)
-  : QDialog(parent),
+  : QDialog(parent,
+            Qt::WindowSystemMenuHint |
+            Qt::WindowCloseButtonHint |
+            Qt::Dialog |
+            Qt::WindowMaximizeButtonHint),
     qthread(gen, mesh, mainShape)
 {
   // --
   setWindowTitle(tr("Compute"));
+  setMinimumWidth( 200 );
+
   cancelButton = new QPushButton(tr("Cancel"));
   cancelButton->setDefault(true);
+
+  QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
+  QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
+  nbNodesLabel = new QLabel("              0", this );
+  nbElemsLabel = new QLabel("              0", this );
+
+  QGridLayout* layout = new QGridLayout(this);
+  layout->setMargin( MARGIN );
+  layout->setSpacing( SPACING );
+  layout->addWidget(nbNodesName,  0, 0);
+  layout->addWidget(nbNodesLabel, 0, 1);
+  layout->addWidget(nbElemsName,  1, 0);
+  layout->addWidget(nbElemsLabel, 1, 1);
+  layout->addWidget(cancelButton, 2, 0, 1, 2);
+  adjustSize();
+  update();
+
   connect(cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
-  QHBoxLayout *layout = new QHBoxLayout;
-  layout->addWidget(cancelButton);
-  setLayout(layout);
-  resize(200, 50);
   // --
-  startTimer(30); // 30 millisecs
+  startTimer(300); // millisecs
   qthread.start();
 }
 
@@ -758,6 +777,8 @@ void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
     {
       close();
     }
+  nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
+  nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
   event->accept();
 }
 
index 49aa2477c77ba31127699f7d1c66e54abd1565cd..c01dad073f27301c0fbb49990f60beb425aa9242 100644 (file)
@@ -271,20 +271,21 @@ class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
   Q_OBJECT
     
 public:
-  SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
+  SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var  gen,
                               SMESH::SMESH_Mesh_var mesh,
                               GEOM::GEOM_Object_var mainShape);
-  bool result();
-  void cancel();
-  
+  bool                   result();
+  void                   cancel();
+  SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
+
 protected:
   void run();
   
 private:
-  SMESH::SMESH_Gen_var myGen;
+  SMESH::SMESH_Gen_var  myGen;
   SMESH::SMESH_Mesh_var myMesh;
   GEOM::GEOM_Object_var myMainShape;
-  bool myResult;
+  bool                  myResult;
 };
 
 /*!
@@ -296,8 +297,8 @@ class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
   Q_OBJECT
     
 public:
-  SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
-                                     SMESH::SMESH_Gen_var gen,
+  SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *             parent,
+                                     SMESH::SMESH_Gen_var  gen,
                                      SMESH::SMESH_Mesh_var mesh,
                                      GEOM::GEOM_Object_var mainShape);
   bool result();
@@ -311,8 +312,9 @@ private slots:
   
 private:
   SMESHGUI_ComputeDlg_QThread qthread;
-  QPushButton *cancelButton;
-  
+  QPushButton *               cancelButton;
+  QLabel *                    nbNodesLabel;
+  QLabel *                    nbElemsLabel;
 };
 
 #endif // SMESHGUI_COMPUTEDLG_H