Hi everyone,

I'm working on an eraser tool for my plugin and want to make it accessible via 
a hotkey.
So I added a transition between the two states (start, eraser) like so:

<statemachine>
                <state name="start" startstate="true">
                                <transition event_class="InteractionKeyEvent" 
event_variant="EraserHotkey" target="eraser">
                                  <action name="enableEraser" />
                                </transition>
                                ...
                </state>

                <state name="eraser" >
                                <transition event_class="InteractionKeyEvent" 
event_variant="EraserHotkey" target="start">
                                  <action name="enableEraser" />
                                </transition>
                                ...
                </state>

                ...
</statemachine>

And the EventConfig:

<config>
  <event_variant class="InteractionKeyEvent" name=" EraserHotkey">
    <attribute name="Key" value="E"/>
  </event_variant>
  ...
</config>

However, the enableEraser Action gets called only sometimes and the conditions 
for that are quite intransparent (it works 2 out of 3 times after 
double-clicking before pressing the Hotkey). I figured it might be something 
with the setup of my Statemachine or EventConfig (I do have multiple states and 
transitions) so I reduced the XML files to only cover the hotkey transition 
(like above) - and indeed it does work more reliably - but only once after a 
preceding mouseclick (LeftClick and then press E will call the enableEraser 
action once, the second and every consecutive press of E will be ignored).

This behaviour does not make sense to me so I tried to debug it. I got stuck at 
QmitkRenderWindow::keyPressEvent(QKeyEvent *ke). The method is connected to the 
Qt Framework and experiences the same behaviour as it is only called under some 
strange circumstances (after a preceding mouseclick). The only thing I can 
think of is maybe an issue with the RenderWindow focus that causes the 
QmitkRenderWindow not to receive the KeyEvents but I'm generally clueless as to 
what might cause this problem.

Did anyone else experience similar problems? I'm using Qt5.10.1 with Windows 10.

Thank you in advance!

Kind regards,

Bertram
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to