Hi Julien,
the important code for this is located in mitkBaseRenderer.cpp.
Here the following methods submitt the event from QT to MITK:
//## @brief Mouse event dispatchers
virtual void MousePressEvent(MouseEvent*);
//## @brief Mouse event dispatchers
virtual void MouseReleaseEvent(MouseEvent*);
//## @brief Mouse event dispatchers
virtual void MouseMoveEvent(MouseEvent*);
//## @brief Wheel event dispatcher
virtual void WheelEvent(mitk::WheelEvent* we);
//## @brief Key event dispatcher
virtual void KeyPressEvent(KeyEvent*);
The question is if the method MouseMoveEvent(..) is called if the two buttons
are pressed.
Quick Test: std::couts in above mentioned methods.
Order of performed events: LeftMousePress, RightMousePress, MiddleMousePress,
MouseMove, LeftMouseRelease, RightMouseRelease, MiddleMouseRelease.
Results are, that the above mentioned methods get called in following order:
MousePress, MousePress, MousePress, MouseMove, ... MouseMove, MouseRelease,
MouseRelease, MouseRelease
So the events are passed and you could do the following:
StartState1
Stay in state1 on MouseRelease
Going from state 1 to 2 if rightMousePress
State2
Going from state2 to 3 if leftMousePress
Going from state2 to 1 if MouseRelease
State3
Staying in state3 on MouseMove and performing desired Action
Going from state3 to 1 if MouseRelease
This way the user has to press rightMouseButton first and the leftMouseButton.
If both buttons shall be pressed at once, you will have to represent both
combinations (starting left, then right and starting right and then left; both
directions leading to state 3). QT will fire two separate events no matter how
synchronous you press the two buttons. (You will also have to take care for
left- and rightMouseButton seperately.)
Even though I haven't tested it, this should work nicely.
Best regards,
Ingmar
-----Ursprüngliche Nachricht-----
Von: Julien Le Pallec [mailto:[email protected]]
Gesendet: Montag, 12. September 2011 12:05
An: [email protected]
Betreff: Re: [mitk-users] Question to Events and the State machine in mitk
Hi,
I am actually working on something similar (do an action when both mouse
buttons
are pressed and the mouse moves) and had the same idea of "buffer" states to
reach the final state where I want the action emmitted.
The problem is that when I reach the state where both buttons are clicked, the
transition occuring when the mouse moves (I also tried Left/Right click + Move)
is never called. It seems that the association of left + right mouse buttons
pressed blocks the emmission of events like mouse move etc..
So, my question is: Is there any way for me to implement new events based on
both buttons pressed ?
Thanks for your help,
Julien
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
Wegner Ingmar <I.Wegner@...> writes:
>
> Hi Christian,
> 1. you are right, you shouldn't have to change the core. Lately I have been
working on an extension towards
> the state machine mechanism.
> >From Revision #27351 on you have the possibility to load user specified xml
files containing state
> machine patterns.
> For an example on how to use it see mitkStateMachineFactoryTest.
>
> 2. That's a little more tricky: Since the operating system doesn't send
> events
"Space-pressed and
> Mouse-moved" you will have to implement it yourself. E.g. define a pattern
that goes from one state to the
> next in case space is pressed. Then listen for mouse move events. Then leave
the state once space is
> released. By the way, it is much easier if you use a modifier key
(Shift/Strg/Alt/Meta etc). This way you
> can catch the event "Modifier-key and Mouse-moved". Each "regular" key
> submits
an event on its own while
> modifier keys add their state to events caused by regular keys.
>
> Best Regards,
> Ingmar
>
>
> -----Ursprüngliche Nachricht-----
> Von: Wilhelm, Christian
> [mailto:Christian.Wilhelm@...]
> Gesendet: Montag, 24. Januar 2011 18:21
> An: 'mitk-users@...'
> Betreff: [mitk-users] Question to Events and the State machine in mitk
>
> Dear Sir or Madam,
>
> I am writing a plug-in for the Ext-App. Usually you should never change the
core of the main project for your
> plug-in. That's why I want to know if there is another way to interact with
the ExtApp next to adding
> statemachines in the xml.
>
> My second question is about the state machine. I want to use the mousemove
event while i am pressing a button (
> for example the space button or the "m" button). For this I need to add the
Buttonstate of this button into
> the move mouse event definition, am I? Where I get the information which
button effects in which
> buttonstate? Maybe I have to add the buttonstate of buttons, which are unused
at the momant, by my self, but
> what I have to do for this?
>
> Thanks for your help. Christian Wilhelm
> ______________________________________________________________
> Christian Wilhelm
> SHK
> Innovation Center Computer Assisted Surgery (ICCAS)
> Semmelweisstraße 14
> D -- 04103 Leipzig
> Germany
> christian.wilhelm@...
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> mitk-users mailing list
> mitk-users@...
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
>
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users