Commit 20ede6c4 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Merge branch 'qt5-fixes' into 'master'

Qt5 fixes

See merge request !3
parents 3918077d 888e25d9
...@@ -71,6 +71,7 @@ namespace ...@@ -71,6 +71,7 @@ namespace
bool pqEventDispatcher::DeferMenuTimeouts = false; bool pqEventDispatcher::DeferMenuTimeouts = false;
bool pqEventDispatcher::DeferEventsIfBlocked = false; bool pqEventDispatcher::DeferEventsIfBlocked = false;
bool pqEventDispatcher::PlayingBlockingEvent = false;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
pqEventDispatcher::pqEventDispatcher(QObject* parentObject) : pqEventDispatcher::pqEventDispatcher(QObject* parentObject) :
...@@ -79,8 +80,6 @@ pqEventDispatcher::pqEventDispatcher(QObject* parentObject) : ...@@ -79,8 +80,6 @@ pqEventDispatcher::pqEventDispatcher(QObject* parentObject) :
this->ActiveSource = NULL; this->ActiveSource = NULL;
this->ActivePlayer = NULL; this->ActivePlayer = NULL;
this->PlayingBlockingEvent = false;
this->PlayBackStatus = true; this->PlayBackStatus = true;
this->PlayBackFinished = false; this->PlayBackFinished = false;
this->PlayBackPaused = false; this->PlayBackPaused = false;
...@@ -213,6 +212,11 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player) ...@@ -213,6 +212,11 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
this->ActivePlayer = &player; this->ActivePlayer = &player;
QApplication::setEffectEnabled(Qt::UI_General, false); QApplication::setEffectEnabled(Qt::UI_General, false);
QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false); // Show animated menus.
QApplication::setEffectEnabled(Qt::UI_FadeMenu, false); // Show faded menus.
QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false); // Show animated comboboxes.
QApplication::setEffectEnabled(Qt::UI_AnimateTooltip, false); // Show tooltip animations.
QApplication::setEffectEnabled(Qt::UI_FadeTooltip, false); // Show tooltip fading effects.
QObject::connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), QObject::connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()),
this, SLOT(aboutToBlock())); this, SLOT(aboutToBlock()));
...@@ -279,6 +283,7 @@ void pqEventDispatcher::playEventOnBlocking() ...@@ -279,6 +283,7 @@ void pqEventDispatcher::playEventOnBlocking()
return; return;
} }
pqEventDispatcher::PlayingBlockingEvent = true;
//cout << "---blocked event: " << endl; //cout << "---blocked event: " << endl;
// if needed for debugging, I can print blocking annotation here. // if needed for debugging, I can print blocking annotation here.
//cerr << "=== playEvent(2) ===" << endl; //cerr << "=== playEvent(2) ===" << endl;
...@@ -288,7 +293,7 @@ void pqEventDispatcher::playEventOnBlocking() ...@@ -288,7 +293,7 @@ void pqEventDispatcher::playEventOnBlocking()
// { // {
// this->BlockTimer.start(); // this->BlockTimer.start();
// } // }
this->PlayingBlockingEvent = false; pqEventDispatcher::PlayingBlockingEvent = false;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -388,15 +393,25 @@ void pqEventDispatcher::processEventsAndWait(int ms) ...@@ -388,15 +393,25 @@ void pqEventDispatcher::processEventsAndWait(int ms)
pqEventDispatcher::DeferMenuTimeouts = true; pqEventDispatcher::DeferMenuTimeouts = true;
if (ms > 0) if (ms > 0)
{ {
// ms = (ms < 100) ? 100 : ms; QApplication::sendPostedEvents();
QApplication::processEvents();
QEventLoop loop; QEventLoop loop;
QTimer::singleShot(ms, &loop, SLOT(quit())); QTimer::singleShot(ms, &loop, SLOT(quit()));
loop.exec(); loop.exec();
} }
QApplication::processEvents(); // When this gets called during playback from a blocking event loop (e.g. a modal dialog)
// calling `QApplication::processEvents()` has a sideeffect on Qt 5 + OsX where it does
// not quit the eventloop for the modal dialog until a mouse event (for example) is
// received by the application. Avoiding calling QApplication::processEvents when already
// processing a event loop other the apps main event loop avoids that problem.
if (!pqEventDispatcher::PlayingBlockingEvent)
{
QApplication::processEvents();
}
QApplication::sendPostedEvents(); QApplication::sendPostedEvents();
QApplication::processEvents(); if (!pqEventDispatcher::PlayingBlockingEvent)
{
QApplication::processEvents();
}
pqEventDispatcher::DeferMenuTimeouts = prev; pqEventDispatcher::DeferMenuTimeouts = prev;
} }
......
...@@ -138,7 +138,6 @@ public slots: ...@@ -138,7 +138,6 @@ public slots:
void oneStep(); void oneStep();
protected: protected:
bool PlayingBlockingEvent;
bool PlayBackFinished; bool PlayBackFinished;
bool PlayBackPaused; bool PlayBackPaused;
bool PlayBackStatus; bool PlayBackStatus;
...@@ -151,6 +150,8 @@ protected: ...@@ -151,6 +150,8 @@ protected:
/// (such as when waiting from Insitu server @see pqLiveInsituManager). /// (such as when waiting from Insitu server @see pqLiveInsituManager).
static bool DeferEventsIfBlocked; static bool DeferEventsIfBlocked;
static bool PlayingBlockingEvent;
pqEventSource* ActiveSource; pqEventSource* ActiveSource;
pqEventPlayer* ActivePlayer; pqEventPlayer* ActivePlayer;
QTimer BlockTimer; QTimer BlockTimer;
......
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