|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TRENDERERP_INCLUDE
|
|
Toshihiro Shimizu |
890ddd |
#define TRENDERERP_INCLUDE
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qobject></qobject>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmetatype></qmetatype>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "trenderer.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! This is a private class used to convey the TRenderer::startRendering
|
|
Toshihiro Shimizu |
890ddd |
//! methods into Qt queued slots. This is necessary since these methods implicitly
|
|
Toshihiro Shimizu |
890ddd |
//! perform event processing, which could cause trouble in case they are invoked from
|
|
Toshihiro Shimizu |
890ddd |
//! events which must respect a strict ordering.
|
|
Toshihiro Shimizu |
890ddd |
//! \n \n
|
|
Toshihiro Shimizu |
890ddd |
//! For example, suppose that a render must be invoked upon a mousePressEvent,
|
|
Toshihiro Shimizu |
890ddd |
//! and that such event must have been completely processed before the corrispondant
|
|
Toshihiro Shimizu |
890ddd |
//! mouseReleaseEvent is invoked - calling the startRendering method *directly* by
|
|
Toshihiro Shimizu |
890ddd |
//! the mousePressEvent may cause the mouseReleaseEvent to be processed before the
|
|
Toshihiro Shimizu |
890ddd |
//! former's end.
|
|
Toshihiro Shimizu |
890ddd |
class TRendererStartInvoker : public QObject
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
struct StartInvokerRenderData {
|
|
Toshihiro Shimizu |
890ddd |
unsigned long m_renderId;
|
|
Toshihiro Shimizu |
890ddd |
const RenderDataVector *m_renderDataVector;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TRendererStartInvoker()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
qRegisterMetaType<startinvokerrenderdata>("StartInvokerRenderData");</startinvokerrenderdata>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(this, SIGNAL(startRender(TRendererImp *, StartInvokerRenderData)),
|
|
Toshihiro Shimizu |
890ddd |
this, SLOT(doStartRender(TRendererImp *, StartInvokerRenderData)),
|
|
Toshihiro Shimizu |
890ddd |
Qt::QueuedConnection);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
~TRendererStartInvoker() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static TRendererStartInvoker *instance()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
static TRendererStartInvoker theInstance;
|
|
Toshihiro Shimizu |
890ddd |
return &theInstance;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void emitStartRender(TRendererImp *renderer, StartInvokerRenderData rd);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Q_SIGNALS :
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
startRender(TRendererImp *, StartInvokerRenderData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public Q_SLOTS:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void doStartRender(TRendererImp *, StartInvokerRenderData rd);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //TRENDERERP_INCLUDE
|