Salome HOME
debug an abort on progress bar show: experiment on progress bar control
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 8 Nov 2019 22:03:55 +0000 (23:03 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 8 Nov 2019 22:03:55 +0000 (23:03 +0100)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx
src/HYDROGUI/HYDROGUI_SIProgressIndicator.h
src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx
src/HYDROGUI/HYDROGUI_ZIProgressIndicator.h

index 80d8592130930abb7b468649139a754cdc926ee5..9e79b797b9d2a6f6cd75b4fbc61124752b9cc201 100755 (executable)
@@ -1101,7 +1101,7 @@ NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
   while( aFuture.isRunning() ) {
     if ( aZIProgress ) {
       aZIProgress->Show( Standard_True );
-      QThread::usleep(500);
+      QThread::msleep(200);
     }
   }
   //DEBTRACE("aZIProgress=" << aZIProgress);
@@ -1166,7 +1166,7 @@ std::vector<double> HYDROData_CalculationCase::GetStricklerCoefficientForPoints(
   while( aFuture.isRunning() ) {
     if ( aSIProgress ) {
       aSIProgress->Show( Standard_True );
-      QThread::usleep(500);
+      QThread::msleep(200);
     }
   }
 
index fb8b07f101b22bcafa739159dd0121ccc3fbb5ef..2a85c6630078c64b12bc388f27200478db75e0ef 100755 (executable)
@@ -21,6 +21,8 @@
 #include <QProgressBar>
 #include <QVBoxLayout>
 #include <QApplication>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
 
 IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_SIProgressIndicator, Message_ProgressIndicator)
 
@@ -49,6 +51,9 @@ HYDROGUI_SIProgressIndicator::~HYDROGUI_SIProgressIndicator()
 Standard_Boolean HYDROGUI_SIProgressIndicator::Show(const Standard_Boolean theForce)
 {
   Standard_Real aPosition = GetPosition();
+  myCount++;
+  if (theForce)
+      DEBTRACE("aPosition=" << aPosition << " myCount:" <<myCount);
   Standard_Boolean isUserBreak = UserBreak();
 
   bool isFinished = aPosition >= 1 || ( isUserBreak && GetNbScopes() < 2 );
@@ -84,6 +89,7 @@ void HYDROGUI_SIProgressIndicator::Reset()
   setButtonText( Cancel, tr("CANCEL") );
   setButtonEnabled( true, Cancel );
   myUserBreak = Standard_False;
+  myCount = 0;
 }
 
 void HYDROGUI_SIProgressIndicator::reject()
index b077de5bedc172e332c7308c0b1472732a9c08cf..c2801f2de4294600c762a5d69d74207e00155cb3 100755 (executable)
@@ -45,6 +45,7 @@ protected slots:
 private:
   QProgressBar* myBar;
   Standard_Boolean myUserBreak;
+  int myCount;
 
 public:
   DEFINE_STANDARD_RTTIEXT (HYDROGUI_SIProgressIndicator, Message_ProgressIndicator)
index 58a021eea5c4cd65cf7ab147e7417cf471072dd3..b19674e3e9a77c5958a98644098b05f246885f2c 100755 (executable)
@@ -25,6 +25,8 @@
 #include <QProgressBar>
 #include <QVBoxLayout>
 #include <QApplication>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
 
 IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_ZIProgressIndicator, Message_ProgressIndicator)
 
@@ -66,6 +68,9 @@ Standard_Boolean HYDROGUI_ZIProgressIndicator::Show(const Standard_Boolean theFo
 {
   Standard_Boolean isUserBreak = UserBreak();
   Standard_Real aPosition = GetPosition(); 
+  myCount++;
+  if (theForce)
+      DEBTRACE("aPosition=" << aPosition << " myCount:" <<myCount);
 
   if ( !theForce ) {
     // quadtree
@@ -122,6 +127,7 @@ void HYDROGUI_ZIProgressIndicator::Reset()
   setButtonText( Cancel, tr("CANCEL") );
   setButtonEnabled( true, Cancel );
   myUserBreak = Standard_False;
+  myCount = 0;
 }
 
 void HYDROGUI_ZIProgressIndicator::reject()
index 11ea765287147804c2f267aad3434b84f657104b..c6c776790236b6387c2d764558306f11dda8f32a 100755 (executable)
@@ -50,6 +50,7 @@ private:
 
   Standard_Real myQuadTreePosition;
   Standard_Boolean myUserBreak;
+  int myCount;
 
 public:
   DEFINE_STANDARD_RTTIEXT (HYDROGUI_ZIProgressIndicator, Message_ProgressIndicator)