Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
Description
Description
Importing VirtualKeyboard module breaks the import if Qt application is not set to use the VirtualKeyboard as input method module (QT_IM_MODULE environment variable). It's hard to specify what should really happen in such case, but one thing for sure: the current error message is very misleading and inappropriate.
In my case, I had my custom InputPanel singleton type in a directory with qmldir. My project has two build artifacts: main app (which uses virtual keyboard) and a playground (which doesn't). Now, attempt to import and use other, even non-singleton, types from that module/directory fails in a playground, because QT_IM_MODULE is not enabled. As a workaround, I moved that custom InputPanel into a separate directory which only ever gets imported from relevant pages of the main app, and never from the playground.
Steps to reproduce
1. Create a template QtQuick app (check "use virtual keyboard" option on your way).
2. Comment out qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); or anything like that in main.cpp.
3. Create a module with a singleton component of InputPanel type, which obviously uses import QtQuick.VirtualKeyboard 2.15 import.
3. From main.qml import the module created in step 3.
4. Build & Run.
Expected result
Either one or a combination of:
- Warning message to stderr
- Fatal error to stdout and exit
- Silently skip an import and pretend nothing happened (pretty shady)
- Provide stub types
Actual result
QQmlApplicationEngine failed to load component qrc:/main.qml:19:5: Type InputPanel unavailable qrc:/QtQuick/VirtualKeyboard/content/InputPanel.qml:127:5: Type Keyboard unavailable qrc:/QtQuick/VirtualKeyboard/content/components/Keyboard.qml:38:1: module "QtQuick.VirtualKeyboard.Plugins" is not installed
This error message is pretty far from what's actually going on, and is very confusing. It makes people file irrelevant bug reports like this: https://github.com/sddm/sddm/issues/1290 — can't really blame them: they have everything installed, but their software mysteriously doesn't work.