Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISUGUI / VisuGUI_Prs3dTools.h
index 3a75c75407144a1300c739f755187c7ec7fea9a7..10716c3680cff6de7637acd25ecefd3dfa42419f 100644 (file)
 #define VisuGUI_Prs3dTools_HeaderFile
 
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_DialogRunner.h"
+
+int runAndWait( QDialog* dlg, const bool modal )
+{
+  VisuGUI_DialogRunner r( dlg );
+  return r.run( modal );
+}
 
 namespace VISU
 {
   class CutLines_i;
 
   //---------------------------------------------------------------
-  template<class TPrs3d_i, class TDlg>
+  template<class TPrs3d_i, class TDlg, int IsDlgModal >
   void
   EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
   {
@@ -44,7 +51,7 @@ namespace VISU
     if (aPrsObject) {
       TDlg* aDlg = new TDlg (theModule);
       aDlg->initFromPrsObject(aPrsObject);
-      if (aDlg->exec()) {
+      if (runAndWait(aDlg,IsDlgModal)) {
        if (!(aDlg->storeToPrsObject(aPrsObject))) {
          delete aDlg;
          return;
@@ -130,8 +137,8 @@ namespace VISU
       if(!aValue){
        if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
          aDlg->initFromPrsObject(aPrs3d);
-         if(IsDlgModal)
-           if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
+
+           if(runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
              // Optionally, create table and curves for cut lines
              QApplication::setOverrideCursor(Qt::waitCursor);
              CreateCurves( theModule,
@@ -145,10 +152,6 @@ namespace VISU
              delete aDlg;
              return false;
            }
-         else{
-           aDlg->show();
-           return true;
-         }
        }
       }
       PublishInView(theModule,aPrs3d);