A virtual keyboard for touch-screen application

Virtual Keyboard for touch-screen devices written in C/C++ Qt, compatible for Qt 4.x and 5.x The widget works with QLineEdit, but you can modify it for your convenience.


-- Floating or embedded in QWidget feature
-- Numeric Keyboard
-- click sound buttons
-- copy/cut and paste facility
-- echo password facility
-- dynamic keyboard layout based on selected language
-- move around textbox using TAB or directly click on a textbox (require subclassing as in the provided example)
-- Dual mode keyboard: large and small
-- zoom facility for pressed keys

Supported Languages:


We appreciate any donation since this will be used to improve or better support this project.

Have a nice day
Last changelog:

Added missing files 1 month ago

Added new form files missed out in the last commit.



6 years ago

Where can i find it?
I don't know if it is possible...



8 years ago

Hi AlterX:

I modified the code to send the events to active widget where the caret is...

void widgetKeyBoard::receiptChildKey(QKeyEvent *event, bool reset)
static QLineEdit *nextInput = NULL;

if (reset == true) { // reinizializza il controllo
nextInput = this->getNextTextbox(true);
if (nextInput == NULL)

// inizia l'analisi del carattere ricevuto:
QString newKey = event->text();
//QString tmpReceiptString = nextInput->text();
QWidget* qMainWnd = QApplication::activeWindow ();
if( qMainWnd != NULL)
QWidget * qFocusWidget = m_pInputPanel->focusWidget() ;

if (newKey.contains(KEY_RETURN, Qt::CaseInsensitive) == true || newKey.contains(KEY_TAB, Qt::CaseInsensitive) == true) { // trattasi di TAB, si sposta alla text successiva
//nextInput = this->getNextTextbox();
//if (nextInput != NULL) nextInput->setFocus(Qt::TabFocusReason);
QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Enter, event->modifiers(), event->text());
QApplication::sendEvent (qFocusWidget, &keyEvent);
else if (newKey.contains(KEY_BACKSPACE, Qt::CaseInsensitive) == true) { // trattasi di CANCELLARE carattere, si sposta alla text successiva
//tmpReceiptString = tmpReceiptString.left(tmpReceiptString.length() - 1);
QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Backspace, event->modifiers(), event->text());
QApplication::sendEvent (qFocusWidget, &keyEvent);
else if (newKey.contains(KEY_CTRL, Qt::CaseInsensitive) == true || newKey.contains(KEY_ALT, Qt::CaseInsensitive) == true || newKey.contains(KEY_ALT_GR, Qt::CaseInsensitive) == true)
; // non esegue nessuna operazione
else { // si tratta di un carattere da visualizzare nella casella di testo corrente
// tmpReceiptString += newKey;
// nextInput->setText(tmpReceiptString);
QApplication::sendEvent (qFocusWidget, event);

Also updated widgetKeyBoard with
QWidget* m_pInputPanel data member...

Kind of registering the top level panel who wants to receive the inputs..

void widgetKeyBoard::createKeyboard(QWidget* pInputPanel)
m_pInputPanel = pInputPanel;

Another note is you could use Qt::Key enums instead of relying the TEXT for the special keys that will render the above code much simpler.

Pl. let me know what you think.


Added missing files 1 month ago

Added new form files missed out in the last commit.

Numeric Keyboard feature 2 months ago

Added feature to create a numeric keyboard (check that out in the screenshot)

Improved keyboard behaviour 3 months ago

It is now possible to create several instance in the same application (previous version only one instance allowed)
Keyboard can now be created as floating widget or embedded in a QWidget
A new parameter in the show() allows to specify the QLineEdit to start with when the keyboard shows up
Extended example to show above features

8 years ago

A new resynch of code was required since during the transfer of the code to github something went wrong resulting in a strange language localization.
Now the code is up-to-date and it seems to work well.
Please let me know if you have any problem

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
updated Aug 23 2017
added Jun 23 2009
downloads today
page views today 47