From 8918ed47c9ea5a4a5e007bb8658010304e3b4358 Mon Sep 17 00:00:00 2001 From: asl Date: Thu, 6 Oct 2005 05:02:50 +0000 Subject: [PATCH] PAL9807 - some dialogs in VISU must be non-modal --- src/VISUGUI/VisuGUI.cxx | 16 ++++++++-------- src/VISUGUI/VisuGUI_Prs3dTools.h | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index bf9aa8e2..b33dcf47 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -697,7 +697,7 @@ OnEditScalarMap() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -711,7 +711,7 @@ OnEditDeformedShape() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -725,7 +725,7 @@ OnEditCutPlanes() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -739,7 +739,7 @@ OnEditCutLines() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -753,7 +753,7 @@ OnEditIsoSurfaces() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -767,7 +767,7 @@ OnEditVectors() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -781,7 +781,7 @@ OnEditStreamLines() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } @@ -795,7 +795,7 @@ OnEditPlot3D() { Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); + EditPrs3d(this, aPrs3d); if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ aViewWindow->highlight(anIO, 1); } diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 3a75c754..2e970245 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -31,12 +31,24 @@ #include "VisuGUI_Tools.h" +int runAndWait( QDialog* dlg, const bool modal ) +{ + if( modal ) + return dlg->exec(); + + dlg->show(); + + qApp->enter_loop(); + + return dlg->result(); +} + namespace VISU { class CutLines_i; //--------------------------------------------------------------- - template + template void EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d) { @@ -44,7 +56,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 +142,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 +157,6 @@ namespace VISU delete aDlg; return false; } - else{ - aDlg->show(); - return true; - } } } PublishInView(theModule,aPrs3d); -- 2.39.2