在 OSX 上部署基于 Qt QML 的应用程序(使用 WebKit)
我们编写了一个大量使用 QML 的应用程序,现在是时候尝试部署它了,由于对 QtWebKit 的依赖,我遇到了非常恼人的问题,
我编译了该应用程序,并且在我的计算机上一切正常。然后我在 .app 上运行 macdeployqt 脚本,无论出于何种原因,WebView QML 组件都会显示:“模块 QtWebKit 未安装”
在 OSX 上部署依赖于 QtWebKit/WebView 的基于 QML 的应用程序的正确方法是什么?
We wrote an application that makes heavy use of QML, and now that it's time to try to deploy it I'm running into really irritating issues because of the reliance on QtWebKit
I compile the application and everything works fine on my computer. Then I run the macdeployqt script on the .app, and for whatever reason the WebView QML component is saying: "Module QtWebKit is not installed"
What is the proper way to deploy a QML-based application on OSX that relies on QtWebKit/WebView?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
macdeployqt 尚不处理 QML 导入插件:
http://bugreports.qt-project.org/browse/QTBUG-14342
您可以手动执行此操作(例如对于 QMLViewer):
1)将您感兴趣的插件从 $QTDIR/imports 目录复制到 $QTDIR/bin/QMLViewer.app/Contents/MacOS,以便有例如
QMLViewer.app/ Contents/MacOS/QtWebKit/qmldir
2) 使用 install_name_tool 修复导入插件对 Qt 框架的引用:
install_name_tool -change /path/to/qt/*lib/QtCore.framework/Versions/4/QtCore @executable_path/.. /Frameworks/QtCore.framework/Versions/4.0/QtCore QMLViewer.app/Contents/MacOS/QtWebKit/libqmlwebkitplugin.dylib
对插件依赖的其他 Qt 库(至少是 QtGui)执行相同的操作。
有关修复引用的更多信息,请访问 http://doc.trolltech.com/4.7/部署-mac.html
macdeployqt doesn't handle the QML import plugins yet:
http://bugreports.qt-project.org/browse/QTBUG-14342
You can do it manually (e.g. for QMLViewer):
1) Copy the plugins you're interested in from the $QTDIR/imports directory into $QTDIR/bin/QMLViewer.app/Contents/MacOS, so that there's e.g.
QMLViewer.app/Contents/MacOS/QtWebKit/qmldir
2) Fix the references of the import plugin to the Qt frameworks using install_name_tool:
install_name_tool -change /path/to/qt/*lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore QMLViewer.app/Contents/MacOS/QtWebKit/libqmlwebkitplugin.dylib
Do the same for the other Qt libraries that the plugin depends on (at least QtGui).
More info on fixing references can be found in http://doc.trolltech.com/4.7/deployment-mac.html
MartinJ 的回答让我很为难。
对于那些使用 Qt Quick 2 的用户 - 请使用
$QTDIR/qml
文件夹中的QtWebkit
来代替,否则您将会收到很多关于插件qtwebkit< 的消息/code> 未实现
qqmltypesextensioninterface
。MartinJ's answer gave me a hard time.
For those who use Qt Quick 2 - use
QtWebkit
from folder$QTDIR/qml
instead, or you're going to have a lot of messages that pluginqtwebkit
does not implementqqmltypesextensioninterface
.