【问题标题】:Activation and Deployment of `QVirtualKeyboard` (in Windows)`QVirtualKeyboard` 的激活和部署(在 Windows 中)
【发布时间】:2017-12-22 08:18:57
【问题描述】:

如何为我的应用程序激活 Qt5 虚拟键盘? 更重要的是,Qt 虚拟键盘需要哪些文件才能出现在我部署的应用程序中?

我问的是这种问答方式,因为我花了很长时间才把所有的点点滴滴放在一起。也许其他人会从中受益。

【问题讨论】:

    标签: c++ windows qt qt5


    【解决方案1】:

    documentation for Qt Virtual Keyboard 实际上并没有那么糟糕。然而,对于QtWidgets/C++ 项目而言,为已部署的应用程序准备好一切仍然具有挑战性。我已经使用 Qt 5.10 和 Windows 10 测试了以下建议:

    1. 安装虚拟键盘。在 Windows 中,可以使用 Qt 安装程序,通过选择相应 Qt 版本下的“Qt 虚拟键盘”选项。

      (告诉我其他平台需要什么 - 我会添加这些信息)

    2. Enable the environment variable,即加载插件可以在main.cpp中实现(在实例化任何QApplication之前):

      qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
      

      这将为任何输入字段启用虚拟键盘。

    3. 部署应用程序需要哪些文件?虚拟键盘需要自己的plugin.dll,它依赖于模块Qt5Network, QtQml, QtQuick, QtSvg。所以目录结构必须至少有这些文件:

      platforminputcontexts/qtvirtualkeyboardplugin.dll
      YOURBIN.exe
      Qt5Network.dll
      Qt5Qml.dll
      Qt5Quick.dll
      Qt5Svg.dll
      

      编辑:插件会动态加载更多插件,同样使用插件描述文件,所以也部署这些(在qt安装目录的qml子目录中找到它们):

      Qt/labs/folderlistmodel/qmldir
      Qt/labs/folderlistmodel/qmlfolderlistmodelplugin.dll
      QtQuick/Layouts/qmldir
      QtQuick/Layouts/qquicklayoutsplugin.dll
      QtQuick/VirtualKeyboard/Styles/qmldir
      QtQuick/VirtualKeyboard/Styles/qtvirtualkeyboardstylesplugin.dll
      QtQuick/Window.2/qmldir
      QtQuick/Window.2/windowplugin.dll
      QtQuick.2/qmldir
      QtQuick.2/qtquick2plugin.dll
      
    4. 除了这些文件之外,还需要标准 Dll 和可能的其他插件、DLL。这一切都取决于您的配置以及您是否使用 MSVC 或 MinGW:

      iconengines/...dll
      imageformats/...dll
      platform/...dll
      Qt5Gui.dll
      Qt5Widget.dll
      Qt5Core.dll
      libwinpthread-1.dll
      libEGL.dll
      libGLESv2.dll
      libstdc++-6.dll
      libgcc_s_dw2-1.dll
      

    注意:qt windows deployment tool 是一个不错且方便的工具。但是,默认情况下,它不会复制虚拟键盘所需的所有文件。

    编辑 - 注意 2:qt windows deployment tool 可以复制几乎所有需要的文件。它不会复制虚拟键盘样式的 DLL(Qt 5.10,Mingw)。如果只需要虚拟键盘,它也会复制很多不必要的文件:

    windeployqt.exe --compiler-runtime --qmldir c:\Qt\5.10.0\mingw53_32\qml 
    --quick --qml --release --force PATH_TO_BINARY
    

    然后手动创建目录/复制相应的 DLL + qmldir from 和 to:

    QtQuick/VirtualKeyboard/Styles
    

    【讨论】:

      猜你喜欢
      • 2012-04-01
      • 2010-09-18
      • 1970-01-01
      • 2013-08-30
      • 1970-01-01
      • 1970-01-01
      • 2019-01-13
      • 2022-12-15
      • 2012-05-25
      相关资源
      最近更新 更多