PyQt5 – Show virtual keyboard

First, be the binaries associated with Qt VirtualKeyboard, and to not install Qt I have used aqtinstall(In this example Qt 5.15 was installed but it is recommended to use the same version that was used to compile pyqt5: python -c "from PyQt5.QtCore import QT_VERSION_STR; print('Qt version', QT_VERSION_STR)"):

python -m pip install aqtinstall
python -m aqt install 5.15.0 windows desktop win64_msvc2019_64 -m qtvirtualkeyboard --outputdir qt

Then it is located where the PyQt5 prefix path is:

python -c "from PyQt5.QtCore import QLibraryInfo; print('QT_PREFIX_PATH:', QLibraryInfo.location(QLibraryInfo.PrefixPath))"

Output:

QT_PREFIX_PATH: C:/Users/eyllanesc/qt_env/lib/site-packages/PyQt5/Qt

Then you have to copy the following from the folder where Qt was installed (the folder is called qt) to the prefix path (which is obtained with the previous command) of PyQt5:

  • Copy “qt/5.15.0/msvc2019_64/bin/Qt5VirtualKeyboard.dll” file to “QT_PREFIX_PATH/bin” folder.
  • Create the folder “QT_PREFIX_PATH/plugins/platforminputcontexts”.
  • Copy “qt/5.15.0/msvc2019_64/plugins/platforminputcontexts/qtvirtualkeyboardplugin.dll” file to “QT_PREFIX_PATH/plugins/platforminputcontexts” folder.
  • Copy “qt/5.15.0/msvc2019_64/plugins/virtualkeyboard” folder to “QT_PREFIX_PATH/plugins” folder.
  • Copy “qt/5.15.0/msvc2019_64/qml/QtQuick/VirtualKeyboard” folder to “QT_PREFIX_PATH/qml/QtQuick” folder.

enter image description here

For linux it is similar:

python -m aqt install 5.15.0 linux desktop -m qtvirtualkeyboard --outputdir qt

Then

  • Copy “qt/5.15.0/gcc_64/bin/libQt5VirtualKeyboard.so.5” file to “QT_PREFIX_PATH/lib” folder.
  • Create the folder “QT_PREFIX_PATH/plugins/platforminputcontexts”.
  • Copy “qt/5.15.0/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so” file to “QT_PREFIX_PATH/plugins/platforminputcontexts” folder.
  • Copy “qt/5.15.0/gcc_64/plugins/virtualkeyboard” folder to “QT_PREFIX_PATH/plugins” folder.
  • Copy “qt/5.15.0/gcc_64/qml/QtQuick/VirtualKeyboard” folder to “QT_PREFIX_PATH/qml/QtQuick” folder.

Leave a Comment