[Qt-interest] Customizing a Directional Control Widget

Samuel Gaist samuel.gaist at edeltech.ch
Wed Aug 24 17:01:15 CEST 2011


On 24 août 2011, at 16:52, Dooit wrote:

> Hi, I want to create a directional control widget for controlling camera's PTZ. I draw it out, but I found I can only use mouse to use this widget and I don't know how to involved keyboard control in it. I think I should use a widget including five QPushButtons, but that would not be elegant design. I need the directional control widget: 1. keyboard controlling; 2. Outlook and design should be elegant. I currently can't figure out how to do this, I know it's really a simple (maybe a bit of stupid) question, but if somebody can help, I really appreciate.
> 
> 
> -- 
> Victory Loves Preparation.
> Me: http://about.me/dooit 
> <directional control.png>_______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest

Hello,
try overloading the keyboard related events:

http://doc.qt.nokia.com/4.7/qwidget.html#keyPressEvent
http://doc.qt.nokia.com/4.7/qwidget.html#keyReleaseEvent

Hope this helps
Samuel


More information about the Qt-interest-old mailing list