QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType = QEvent::Type(QEvent::registerEventType());
-//TODO(mpv): #4
-//boost::shared_ptr<Events_Message> PostponeMessageQtEvent::postponedMessage()
-boost::shared_ptr<ModelAPI_Document> PostponeMessageQtEvent::resultDoc()
+boost::shared_ptr<Events_Message> PostponeMessageQtEvent::postponedMessage()
{
- return myTestDoc;
+ return myMessage;
}
public:
static QEvent::Type PostponeMessageQtEventType;
- //TODO(mpv): ModelAPI_Document is taken here for example
- //the commented code should be ok when you implement boost::shared_ptr on Events_Message
- //the same for #1-4
- PostponeMessageQtEvent(boost::shared_ptr<ModelAPI_Document> theDoc)
- //PostponeMessageQtEvent(boost::shared_ptr<Events_Message> theMessage)
+ PostponeMessageQtEvent(const boost::shared_ptr<Events_Message>& theMessage)
: QEvent(PostponeMessageQtEventType),
- //TODO(mpv): #1
- //myMessage(theMessage)
- myTestDoc(theDoc)
+ myMessage(theMessage)
{
}
static QEvent::Type type()
return PostponeMessageQtEventType;
}
- //TODO(mpv): #2
- //boost::shared_ptr<Events_Message> postponedMessage();
- boost::shared_ptr<ModelAPI_Document> resultDoc();
+ boost::shared_ptr<Events_Message> postponedMessage();
private:
- //TODO(mpv): #3
- //boost::shared_ptr<Events_Message> myMessage;
- boost::shared_ptr<ModelAPI_Document> myTestDoc;
+ boost::shared_ptr<Events_Message> myMessage;
};
#endif /* XGUI_QEVENTS_H_ */
std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
#endif
SessionPtr aMgr = ModelAPI_Session::get();
- PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(aMgr->activeDocument());
+ PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(theMessage);
QApplication::postEvent(this, aPostponeEvent);
return;
}
std::cout << "XGUI_Workshop::event " << "I am in the Qt's thread: "
<< isMyThread << std::endl;
#endif
- boost::shared_ptr<ModelAPI_Document> aDoc = aPostponedEv->resultDoc();
- if (aDoc) {
-#ifdef _DEBUG
- std::cout << "XGUI_Workshop::event " << "Passed boost ptr is ok, doc id: " << aDoc->id()
- << std::endl;
-#endif
- }
- //TODO(mpv): After modifications in the XGUI_QtEvents.* this code should be like...
- //boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
- //processEvent(aEventPtr);
+ boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
+ processEvent(aEventPtr);
return true;
}
return false;