Search code examples
c++qttextkeyboard-eventsabbreviation

How to modify the keyboard input in QT?


The following feature needs to be implemented to our existing QT & C++ application. We have to expand the user typed abbreviations into pre-defined words(s). The functionality we need to implement is something similar to text expander. Say if a user typed "FL", this needs to be replaced to "Florida" after immediately.

I was able to find out the QT documentation for capturing the key events, but I'm not sure how to modify the keyboard input with pre-defined characters set.

It would be great if you guys provide me some sample code and directions on this.

Thanks in advance!


Solution

  • Could this example be useful to you ?

    They use a mecanism called completer, that provides different words for a given entry... It's quite like a dictionnary on a cell phone...

    Custom Completer Example :

    http://qt.nokia.com/doc/4.6/tools-customcompleter.html

    Hope it helps a bit !