[Qt-interest] Help to Implement Easter Egg after certain key pattern is entered

Andre Somers andre at familiesomers.nl
Thu Feb 4 09:11:01 CET 2010


Mike Short wrote:
> I have written a small app in Qt that consists of a QWiget that 
> contains a QGroupBox, and inside that there are 2 layouts, one that 
> has 3 QPushButtons, and the other has various QRadioButtons, and 
> depending on what QRadioButton is selected when a certain QPushButton 
> is clicked, dictates how the utility functions or what task it completes.
>  
> I would like to add in a special feature or Easter Egg that appears 
> only after the user has pushed certain keys on the keyboard in a 
> certain order or pattern.
>  
> Has anyone tried anything like this?
>  
> I would appreciate any ideas on how something like this can be done in 
> an efficient manner, or if anyone else has done this successfully,then 
> what approach did you take to achieve the desired results?
>  
> Thanks in advance..
>  
> -Mike Short
> Fawkes Engineering, LLC
Very simple. I use a QKeySequence with multiple keys and that works very 
well. Use it to create a QShortcut, and connect the signal that shortcut 
provides to trigger whatever you want. I just create it from my main, 
but that depends on your application. See the QKeySequence docs under 
"GNU Emacs Style Key Sequences".

André




More information about the Qt-interest-old mailing list