To solve this problem, I have to resort to qt plugin. The following links will provide all the necessary material to write and deploy a plugin.
The plugin is a dynamic library that qt app looks for when it starts. In this case, the "customized qt keyboard driver" is located at qt-binary-directory/kbddrivers/libhotplugkbplugin.so. Before start the app, set the key board environment variable:
The plugin is based on the simplestyle plugin below structure-wise and based on the qt internal linuxInput driver function-wise.