Revert "Progress: optionally call QApplication::processEvents on progress updates."

This reverts commit eb762fd122.
This commit is contained in:
Magne Sjaastad 2024-09-10 08:18:37 +02:00
parent 1235c3f92e
commit cfc97bb615
3 changed files with 17 additions and 28 deletions

View File

@ -174,7 +174,7 @@ bool RimWellPathCollection::loadDataAndUpdate()
return count;
};
caf::ProgressInfo progress( allWellPaths().size() + countWellLogs( allWellPaths() ) + 2, "Reading well paths from file", false, true, false );
caf::ProgressInfo progress( allWellPaths().size() + countWellLogs( allWellPaths() ) + 2, "Reading well paths from file", false, true );
readWellPathFormationFiles();

View File

@ -127,15 +127,11 @@ ProgressTask::~ProgressTask()
/// If you do not need a title for a particular level, simply pass "" and it will be ignored.
/// \sa setProgressDescription
//--------------------------------------------------------------------------------------------------
ProgressInfo::ProgressInfo( size_t maxProgressValue,
const QString& title,
bool delayShowingProgress,
bool allowCancel,
bool shouldProcessEvents )
ProgressInfo::ProgressInfo( size_t maxProgressValue, const QString& title, bool delayShowingProgress, bool allowCancel )
{
m_isCancelled.store( false );
ProgressInfoStatic::start( *this, maxProgressValue, title, delayShowingProgress, allowCancel, shouldProcessEvents );
ProgressInfoStatic::start( *this, maxProgressValue, title, delayShowingProgress, allowCancel );
if ( dynamic_cast<QApplication*>( QCoreApplication::instance() ) )
{
@ -480,10 +476,9 @@ ProgressInfoBlocker::~ProgressInfoBlocker()
///
//==================================================================================================
bool ProgressInfoStatic::s_disabled = false;
bool ProgressInfoStatic::s_running = false;
bool ProgressInfoStatic::s_isButtonConnected = false;
bool ProgressInfoStatic::s_shouldProcessEvents = true;
bool ProgressInfoStatic::s_disabled = false;
bool ProgressInfoStatic::s_running = false;
bool ProgressInfoStatic::s_isButtonConnected = false;
//--------------------------------------------------------------------------------------------------
///
@ -492,11 +487,8 @@ void ProgressInfoStatic::start( ProgressInfo& progressInfo,
size_t maxProgressValue,
const QString& title,
bool delayShowingProgress,
bool allowCancel,
bool shouldProcessEvents )
bool allowCancel )
{
s_shouldProcessEvents = shouldProcessEvents;
if ( !isUpdatePossible() ) return;
std::vector<size_t>& progressStack_v = progressStack();
@ -549,8 +541,8 @@ void ProgressInfoStatic::start( ProgressInfo& progressInfo,
dialog->setValue( static_cast<int>( currentTotalProgress() ) );
dialog->setLabelText( currentComposedLabel() );
}
if ( s_shouldProcessEvents ) QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// if (progressDialog()) progressDialog()->repaint();
}
//--------------------------------------------------------------------------------------------------
@ -567,8 +559,8 @@ void ProgressInfoStatic::setProgressDescription( const QString& description )
{
dialog->setLabelText( currentComposedLabel() );
}
if ( s_shouldProcessEvents ) QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// if (progressDialog()) progressDialog()->repaint();
}
//--------------------------------------------------------------------------------------------------
@ -613,7 +605,8 @@ void ProgressInfoStatic::setProgress( size_t progressValue )
dialog->setValue( totalProgress );
}
if ( s_shouldProcessEvents ) QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// if (progressDialog()) progressDialog()->repaint();
}
//--------------------------------------------------------------------------------------------------
@ -694,6 +687,8 @@ void ProgressInfoStatic::finished()
dialog->setLabelText( currentComposedLabel() );
}
// QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
// If we are finishing the last level, clean up
if ( maxProgressStack_v.empty() )
{

View File

@ -59,11 +59,7 @@ private:
class ProgressInfo
{
public:
ProgressInfo( size_t maxProgressValue,
const QString& title,
bool delayShowingProgress = true,
bool allowCancel = false,
bool shouldProcessEvents = true );
ProgressInfo( size_t maxProgressValue, const QString& title, bool delayShowingProgress = true, bool allowCancel = false );
~ProgressInfo();
void setProgressDescription( const QString& description );
@ -93,8 +89,7 @@ public:
size_t maxProgressValue,
const QString& title,
bool delayShowingProgress,
bool allowCancel,
bool shouldProcessEvents );
bool allowCance );
static void setProgressDescription( const QString& description );
static void setProgress( size_t progressValue );
@ -112,7 +107,6 @@ private:
static bool s_running;
static bool s_disabled;
static bool s_isButtonConnected;
static bool s_shouldProcessEvents;
};
} // namespace caf