Design pattern for mouse interaction

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2012-04-12T16:56:38Z Indexed on 2012/04/12 17:29 UTC
Read the original article Hit count: 208

Filed under:
|

I need some opinions on what is the "ideal" design pattern for a general mouse interaction.

Here the simplified problem. I have a small 3d program (QT and openGL) and I use the mouse for interaction. Every interaction is normally not only a single function call, it is mostly performed by up to 3 function calls (initiate, perform, finalize). For example, camera rotation: here the initial function call will deliver the current first mouse position, whereas the performing function calls will update the camera etc.

However, for only a couple of interactions, hardcoding these (inside MousePressEvent, MouseReleaseEvent MouseMoveEvent or MouseWheelEvent etc) is not a big deal, but if I think about a more advanced program (e.g 20 or more interactions) then a proper design is needed.

Therefore, how would you design such a interactions inside QT.

I hope I made my problem clear enough, otherwise don't bother complain :-)

Thanks

© Stack Overflow or respective owner

Related posts about qt

Related posts about design-patterns