[Interest] Custom QPlatformInputContextPlugin on Windows
Bernhard Seßler
bernhard.sessler at corscience.de
Wed Nov 20 11:21:54 CET 2013
Hi again,
after digging through the platform plugins shipped with Qt5, I've found out that
the windows platform plugin actually does not support loading custom platform
input context plugins (it ships its own QWindowsInputContext and nothing else).
So I've copied the windows platform plugin sources and replaced the
instanciation of QWindowsInputContext with the QPlatformInputContextFactory
loader in QWindowsIntegration. Using this newly created platform plugin (I named
it "wes" :)), my input context plugin is now loading just fine.
A question to the Qt devs: is there a rationale behind the decision to not allow
custom input context plugins on Windows? We are currently developing for Windows
Embedded Standard 7 (but aiming for maximum portability) and it seems odd not to
support custom created input methods on this platform.
Best Regards,
Bernhard
On 19.11.2013 09:53, Bernhard Seßler wrote:
> Hi @all,
>
> I'm currently trying to implement a custom platform input context plugin for Qt
> 5.1.1. For this I've started development on Linux (Ubuntu 13.10 to be precise),
> taken the compose Plugin as starting point and implemented a small virtual
> keyboard widget, which is opened each time an input field gets focus. So far so
> good, the keyboard works just fine on Linux.
> My problem is using this plugin on Windows. I mean, it compiles just fine (using
> both the MingW 4.8 Toolchain coming with Qt itself and the MSVC 2012 x86
> Compiler), but I just can't get Qt to load the plugin (which is driving me mad atm).
>
> I mean, on Linux it's just a matter of copying the shared object file into a
> platforminputcontexts/ subdirectory where the executable resides (or directly
> into the Qt install prefix to plugins/platforminputcontexts). On Windows Qt does
> not event _try_ to open any platforminputcontexts subdirectory (neither where
> the executable resides, nor in the Qt installation directory). So I was
> thinking: "fine, let's copy it to the platforms/ subdirectory". Now Qt
> recognizes the .dll and tries to fetch its metadata - but it seems that it's
> unable to actually retrieve it (the output is just empty). Setting the
> QT_DEBUG_PLUGINS environment variable to 1 prints this when executing my
> application:
>
> ---8<---
> QFactoryLoader::QFactoryLoader() looking at
> "C:/devel/Qt/5.1.1/mingw48_32/plugins/platforms/qwindowsd.dll"
> Got keys from plugin meta data ("windows")
> QFactoryLoader::QFactoryLoader() checking directory path
> "[...]build-mingw/concepts/clickdummy/src/platforms" ...
> QFactoryLoader::QFactoryLoader() looking at
> "[...]build-mingw/concepts/clickdummy/src/platforms/libkeyboardplatforminputcontextplugin.dll"
> Got keys from plugin meta data ()
> loaded library "C:/devel/Qt/5.1.1/mingw48_32/plugins/platforms/qwindowsd.dll"
> --->8---
>
> As you can see, the windows platform plugin is loaded successfully and the
> metadata is read correctly. Unfortunately that's not the case for my custom plugin.
>
> I should mention that I'm using CMake as build system - but I've also tried
> building the plugin with a qmake project file with exactly the same results.
>
> So, is anybody out there willing to give me a hand in this? After all I've tried
> I'm finally at the end of my knowledge. Btw, yes, I've set the QT_IM_MODULE
> environment variable correctly and added QT_SHARED and QT_PLUGIN as compile
> definitions.
>
>
More information about the Interest
mailing list