Commit 600dd400 authored by Ben Payne's avatar Ben Payne

Add public function to allow disabling the playing of events on blocking.

This is useful if a played-back event happens to run an event loop, but
isn't a modal dialog, and the player knows the event should complete before
anything else runs. For example, playing back an event that starts a
blocking event loop waiting for a background thread to finish its work.
parent b597ce02
......@@ -69,6 +69,8 @@ namespace
bool pqEventDispatcher::DeferMenuTimeouts = false;
bool pqEventDispatcher::IgnoreBlocking = false;
pqEventDispatcher::pqEventDispatcher(QObject* parentObject) :
......@@ -115,6 +117,12 @@ void pqEventDispatcher::registerTimer(QTimer* timer)
void pqEventDispatcher::setIgnoreBlocking(bool enable)
pqEventDispatcher::IgnoreBlocking = enable;
void pqEventDispatcher::aboutToBlock()
......@@ -194,7 +202,7 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
void pqEventDispatcher::playEventOnBlocking()
if (pqEventDispatcher::DeferMenuTimeouts)
if (pqEventDispatcher::DeferMenuTimeouts || pqEventDispatcher::IgnoreBlocking)
......@@ -99,6 +99,11 @@ public:
/// event dispatch.
static void registerTimer(QTimer* timer);
/// Disables the behavior where more events may be dispatched if Qt starts
/// waiting in an event loop. Warning: Setting this to true will prevent
/// modal dialogs from functioning correctly.
static void setIgnoreBlocking(bool enable);
/// signal when playback starts
void started();
......@@ -122,6 +127,7 @@ protected:
bool PlayBackFinished;
bool PlayBackStatus;
static bool DeferMenuTimeouts;
static bool IgnoreBlocking;
pqEventSource* ActiveSource;
pqEventPlayer* ActivePlayer;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment