Deploying Qt QML-based application on OSX (with WebKit)
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 p开发者_JAVA百科roper way to deploy a QML-based application on OSX that relies on QtWebKit/WebView?
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'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 plugin qtwebkit
does not implement qqmltypesextensioninterface
.
精彩评论