SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Signals | Static Public Member Functions | Protected Slots | Protected Member Functions | List of all members
pqSMTKCallObserversOnMainThreadBehavior Class Reference

Add logic to new servers to ensure that operation and resource observers are called on the main thread. More...

#include <pqSMTKCallObserversOnMainThreadBehavior.h>

Inheritance diagram for pqSMTKCallObserversOnMainThreadBehavior:
[legend]
Collaboration diagram for pqSMTKCallObserversOnMainThreadBehavior:
[legend]

Signals

void resourceEvent (QString resourceId, int event, QPrivateSignal)
 Signal that a resource rsrc has been added or removed from the manager.
 
void operationEvent (QString opId, int event, QString resultName, QPrivateSignal)
 Signal that an operator op has been created, is about to run, or has run with the included result.
 
void selectionEvent (QString selectionId, QString str, QPrivateSignal)
 Signal that a selection has been made.
 

Static Public Member Functions

static pqSMTKCallObserversOnMainThreadBehaviorinstance (QObject *parent=nullptr)
 

Protected Slots

void forceObserversToBeCalledOnMainThread (pqSMTKWrapper *rsrcMgr, pqServer *server)
 Mutate the logic of the server's operation and resource Observers to be called on the main thread, rather than the thread from which the observation was requested.
 

Protected Member Functions

 pqSMTKCallObserversOnMainThreadBehavior (QObject *parent=nullptr)
 

Detailed Description

Add logic to new servers to ensure that operation and resource observers are called on the main thread.

Qt requires that all methods that affect the GUI be performed on the application's main thread. Many of the registered Observer functions for both operations and resources are designed to affect the GUI. Rather than connect GUI-modifying logic to a signal triggered by an observer, we mutate the behavior of the operation and resource Observer calling logic to ensure that all Observer functors are called on the main thread, regardless of which thread performs the observation.

The logic that allows us to ensure that observations are called on the main thread uses Qt's signals and slots to relay the observation request between threads. Because SMTK's Operation and Resource classes are not wrapped for Qt's signal/slot relay, we instead hold a map of calling Operations and Resources and pass an associated unique id between threads.


The documentation for this class was generated from the following files: