QML 在Mac OS X上运行问题
Unsolved
Chinese
-
本人在开发机上新建QML工程,编译打包成dmg后,在本机可直接点击安装运行。在没有安装Qt环境的目标机上,程序可点击运行,但是程序界面不显示,且程序处于未响应状态。
开发环境为:High Sierra 10.13.6 Qt 5.11.3 + Clang 64bit
目标环境为:Big Sur 11.4
qml代码:
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.6 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Button { x: 300 y: 220 text: qsTr("Click") } }
插件加载日志:
xxxdeiMac-2:~ xxx$ cd Desktop/Qt/qml.app/Contents/MacOS/ xxxdeiMac-2:MacOS xxx$ export QT_DEBUG_PLUGINS=1 xxxdeiMac-2:MacOS xxx$ ./qml QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/platforms" ... QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/platforms/libqcocoa.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/platforms/libqcocoa.dylib, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "cocoa" ] }, "className": "QCocoaIntegrationPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("cocoa") QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/MacOS/platforms" ... loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/platforms/libqcocoa.dylib" QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/MacOS/platformthemes" ... Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libqtquick2plugin.dylib, metadata= { "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0", "MetaData": { }, "className": "QtQuick2Plugin", "debug": false, "uri": [ "QtQuick.2" ], "version": 330499 } loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libqtquick2plugin.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libwindowplugin.dylib, metadata= { "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0", "MetaData": { }, "className": "QtQuick2WindowPlugin", "debug": false, "uri": [ "QtQuick.Window.2" ], "version": 330499 } loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libwindowplugin.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib, metadata= { "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0", "MetaData": { }, "className": "QtQuickControls1Plugin", "debug": false, "uri": [ "QtQuick.Controls" ], "version": 330499 } loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib" QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/MacOS/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats" ... QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqgif.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqgif.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "gif" ], "MimeTypes": [ "image/gif" ] }, "className": "QGifPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("gif") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqicns.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqicns.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "icns" ], "MimeTypes": [ "image/x-icns" ] }, "className": "QICNSPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("icns") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqico.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqico.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "ico", "cur" ], "MimeTypes": [ "image/vnd.microsoft.icon", "image/vnd.microsoft.icon" ] }, "className": "QICOPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("ico", "cur") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqjpeg.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqjpeg.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "jpg", "jpeg" ], "MimeTypes": [ "image/jpeg", "image/jpeg" ] }, "className": "QJpegPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("jpg", "jpeg") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacheif.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacheif.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "heic", "heif" ], "MimeTypes": [ "image/heic", "image/heif" ] }, "className": "QMacHeifPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("heic", "heif") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacjp2.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacjp2.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "jp2" ], "MimeTypes": [ "image/jp2", "image/jpx", "image/jpm", "video/mj2" ] }, "className": "QMacJp2Plugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("jp2") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtga.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtga.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "tga" ], "MimeTypes": [ "image/x-tga" ] }, "className": "QTgaPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("tga") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtiff.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtiff.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "tiff", "tif" ], "MimeTypes": [ "image/tiff", "image/tiff" ] }, "className": "QTiffPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("tiff", "tif") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwbmp.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwbmp.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "wbmp" ], "MimeTypes": [ "image/vnd.wap.wbmp" ] }, "className": "QWbmpPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("wbmp") QFactoryLoader::QFactoryLoader() looking at "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwebp.dylib" Found metadata in lib /Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwebp.dylib, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "webp" ], "MimeTypes": [ "image/webp" ] }, "className": "QWebpPlugin", "debug": false, "version": 330499 } Got keys from plugin meta data ("webp") QFactoryLoader::QFactoryLoader() checking directory path "/Users/xxx/Desktop/Qt/qml.app/Contents/MacOS/imageformats" ... loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqgif.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqicns.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqico.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqjpeg.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacheif.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqmacjp2.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtga.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqtiff.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwbmp.dylib" loaded library "/Users/xxx/Desktop/Qt/qml.app/Contents/PlugIns/imageformats/libqwebp.dylib" ^C xxxdeiMac-2:MacOS xxx$
运行图如下: