Hi Michael,

sorry for the late reply. If you are interested about events in the render windows, you should probably register a mitk::InteractionEventObserver [1] like

class MyEventObserver : public mitk::InteractionEventObserver
{
public:
virtual void Notify(InteractionEvent* event, bool isHandled)
{
  // do something with "event"
}
};


If you want to register your "MyEventObserver" class from within a plug-in, you need to create a "module context" for that plug-in [2] (just look at the attached patch). Then register it like this:

mitk::InteractionEventObserver* observer = new MyEventObserver();
us::ServiceRegistration<mitk::InteractionEventObserver> reg = 
us::GetModuleContext()->RegisterService(observer);


Make sure that "observer" lives long enough and is properly deleted. You might also want to call reg.Unregister(), depending where in your plug-in you call "RegisterService()".

Best,
Sascha

[1] http://docs.mitk.org/2014.03/structmitk_1_1InteractionEventObserver.html
[2] http://thread.gmane.org/gmane.comp.lib.mitk.user/4542/focus=4595

On 07/04/2014 04:05 PM, Michael Smith wrote:

Hello!

What is the best way to pass events (e.g. the keyPressEvent) from QmitkRenderWindow.cpp (MitkQtWidgets) to an own Plugin which was generated with the Plugin Generator?

Best regards!



------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to