From 8e7962d4dc816f832ada2209bb835d1c4eb25b79 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Fri, 8 Nov 2019 23:03:55 +0100 Subject: [PATCH] debug an abort on progress bar show: experiment on progress bar control --- src/HYDROData/HYDROData_CalculationCase.cxx | 4 ++-- src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx | 6 ++++++ src/HYDROGUI/HYDROGUI_SIProgressIndicator.h | 1 + src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx | 6 ++++++ src/HYDROGUI/HYDROGUI_ZIProgressIndicator.h | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 80d85921..9e79b797 100755 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1101,7 +1101,7 @@ NCollection_Sequence 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 HYDROData_CalculationCase::GetStricklerCoefficientForPoints( while( aFuture.isRunning() ) { if ( aSIProgress ) { aSIProgress->Show( Standard_True ); - QThread::usleep(500); + QThread::msleep(200); } } diff --git a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx index fb8b07f1..2a85c663 100755 --- a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx +++ b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx @@ -21,6 +21,8 @@ #include #include #include +#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:" <= 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() diff --git a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.h b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.h index b077de5b..c2801f2d 100755 --- a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.h +++ b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.h @@ -45,6 +45,7 @@ protected slots: private: QProgressBar* myBar; Standard_Boolean myUserBreak; + int myCount; public: DEFINE_STANDARD_RTTIEXT (HYDROGUI_SIProgressIndicator, Message_ProgressIndicator) diff --git a/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx b/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx index 58a021ee..b19674e3 100755 --- a/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx +++ b/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx @@ -25,6 +25,8 @@ #include #include #include +#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:" <