Баги в qt_add_qml_module?
От: SaZ  
Дата: 27.11.23 00:01
Оценка: 3 (1)
Всем доброго времени суток.

Пытаюсь написать нормальный cmake скрипт для сборки и деплоя кутэ приложения (пока только под мак).

Входные условия: два таргета, основное приложение — чисто запускалка всей логики. Вся логика в статической либе.

Суть проблемы: некорректно отрабатывает macdeployqt. Тулза не учитывает модули, которые я импортирую в либе. Но стоит прописать эти импорты в любом .qml файле таргета-приложения, как всё резко начинает работать.

Чтобы не быть голословным, вот наброски: https://github.com/dsazonoff/qt-qml-cmake-testbed/tree/main
И соответственно коммит, который показывает проблему: https://github.com/dsazonoff/qt-qml-cmake-testbed/commit/9fb8ebf13a6664a5c4f17f5a4fedf8492a1f499d
Если же import QtQuick.Dialogs сделать внутри таргета приложения, а не статической либы, то всё ок.

Мысли вслух:
— Где-то что-то не так делаю с target_link_libraries и областью видимости (PRIVATE/PUBLIC)
— Я как-то не так юзаю [qt_add_qml_module](https://github.com/dsazonoff/qt-qml-cmake-testbed/commit/4ed7d9fc248966e6c5fa3019fdfdd641c35fd8c7#diff-c2087cfe428fc15a62ae4ba4a7c02fe67e0216a6993335831102ddef095d592d)
— Я что-то ещё не понимаю про импорт и qml модули...

Определённые ограничения:
— Я не рассматриваю Qt ниже версий 6.6, ибо в последних есть много удобных плюшек
— Пока актуален только мак, но оно всё более-менее кросс-платформенно с xxxxdeployqt
— Не надо предлагать в коде дёргать всякие addImportPath — оно должно само отрабатывать (и отрабатывает для приложений, а не либ), но если ошибка в этом — то укажите
— Не хочется прибегать ни к каким костылям при деплое

Собственно я не поленился сделать репо, которое собирает hello world для отладки, возможно кто-то тыкнет меня в ошибку, а то я уже несколько недель мучаюсь.

P.S. по сути это продолжение вот этого
Автор: SaZ
Дата: 28.07.23
топика. По поводу деплоя кутэ5 всё печально. Самые легкогуглящиеся решения требуют питон2 и уже морально устарели. На многих проектах используют самописные костыли.
Re: Баги в qt_add_qml_module?
От: Skorodum Россия  
Дата: 28.11.23 12:32
Оценка: 2 (1)
Здравствуйте, SaZ, Вы писали:

Дисклеймер: я сам пока не использую > 5.15.

При создании статической библиотеки ты используешь qt_add_qml_module. В документации явно сказано:

The STATIC QML modules also generate the static QML plugins if NO_PLUGIN is not specified. Targets that import such STATIC QML modules also need to explicitly link to corresponding QML plugins.

Note: When using static linking, it might be necessary to use Q_IMPORT_QML_PLUGIN to ensure that the QML plugin is correctly linked.


Вроде все работает так, как и описано.
qml cmake
Re[2]: Баги в qt_add_qml_module?
От: SaZ  
Дата: 29.11.23 17:52
Оценка:
Здравствуйте, Skorodum, Вы писали:

S>Здравствуйте, SaZ, Вы писали:


S>Дисклеймер: я сам пока не использую > 5.15.


S>При создании статической библиотеки ты используешь qt_add_qml_module. В документации явно сказано:

S>

S>The STATIC QML modules also generate the static QML plugins if NO_PLUGIN is not specified. Targets that import such STATIC QML modules also need to explicitly link to corresponding QML plugins.

S>Note: When using static linking, it might be necessary to use Q_IMPORT_QML_PLUGIN to ensure that the QML plugin is correctly linked.


S>Вроде все работает так, как и описано.


Большое спасибо что посмотрели. Увы, не получилось.
ld: warning: ignoring duplicate libraries: 'source/wheel-lib/libwheel.a'
ld: Undefined symbols:
  qt_static_plugin_wheelplugin(), referenced from:
      __GLOBAL__sub_I_main.cpp in main.cpp.o

Если без макроса Q_IMPORT_QML_PLUGIN(wheelplugin) то собирается, но с деплоем та же проблема — не видит импорт диалогов.

Что поменял:
target_link_libraries(${target_name} PRIVATE
    ${qt_libraries}
    wheel            # <--- !!!!!
    wheelplugin
)


Выхлоп со включенной отладкой:

  Последние несколько строк интересны
saz@SaZ-Macbook-Pro Darwin-Release % ./qt-qml-cmake-testbed.app/Contents/MacOS/qt-qml-cmake-testbed
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/platforms" ...
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/platforms/libqcocoa.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/platforms/libqcocoa.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "cocoa"
        ]
    },
    "archlevel": 2,
    "className": "QCocoaIntegrationPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("cocoa")
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/MacOS/platforms" ...
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/platforms/libqcocoa.dylib" loaded library
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/platformthemes" ...
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/MacOS/platformthemes" ...
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/iconengines" ...
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/iconengines/libqsvgicon.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/iconengines/libqsvgicon.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
    "MetaData": {
        "Keys": [
            "svg",
            "svgz",
            "svg.gz"
        ]
    },
    "archlevel": 2,
    "className": "QSvgIconPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz", "svg.gz")
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/MacOS/iconengines" ...
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats" ...
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqgif.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqgif.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "gif"
        ],
        "MimeTypes": [
            "image/gif"
        ]
    },
    "archlevel": 2,
    "className": "QGifPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwbmp.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwbmp.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "wbmp"
        ],
        "MimeTypes": [
            "image/vnd.wap.wbmp"
        ]
    },
    "archlevel": 2,
    "className": "QWbmpPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wbmp")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwebp.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwebp.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "webp"
        ],
        "MimeTypes": [
            "image/webp"
        ]
    },
    "archlevel": 2,
    "className": "QWebpPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("webp")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqico.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.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"
        ]
    },
    "archlevel": 2,
    "className": "QICOPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqmacheif.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqmacheif.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "heic",
            "heif"
        ],
        "MimeTypes": [
            "image/heic",
            "image/heif"
        ]
    },
    "archlevel": 2,
    "className": "QMacHeifPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("heic", "heif")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqjpeg.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqjpeg.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "jpg",
            "jpeg"
        ],
        "MimeTypes": [
            "image/jpeg",
            "image/jpeg"
        ]
    },
    "archlevel": 2,
    "className": "QJpegPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtiff.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtiff.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "tiff",
            "tif"
        ],
        "MimeTypes": [
            "image/tiff",
            "image/tiff"
        ]
    },
    "archlevel": 2,
    "className": "QTiffPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tiff", "tif")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqsvg.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqsvg.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "svg",
            "svgz"
        ],
        "MimeTypes": [
            "image/svg+xml",
            "image/svg+xml-compressed"
        ]
    },
    "archlevel": 2,
    "className": "QSvgPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqicns.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqicns.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "icns"
        ],
        "MimeTypes": [
            "image/x-icns"
        ]
    },
    "archlevel": 2,
    "className": "QICNSPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("icns")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtga.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtga.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
        "Keys": [
            "tga"
        ],
        "MimeTypes": [
            "image/x-tga"
        ]
    },
    "archlevel": 2,
    "className": "QTgaPlugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tga")
qt.core.plugin.factoryloader: looking at "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqmacjp2.dylib"
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.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"
        ]
    },
    "archlevel": 2,
    "className": "QMacJp2Plugin",
    "debug": false,
    "version": 395008
}


qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jp2")
qt.core.plugin.factoryloader: checking directory path "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/MacOS/imageformats" ...
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqgif.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwbmp.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqwebp.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqico.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqmacheif.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqjpeg.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtiff.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqsvg.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqicns.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqtga.dylib" loaded library
qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/imageformats/libqmacjp2.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libworkerscriptplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
    "archlevel": 2,
    "className": "QtQmlWorkerScriptPlugin",
    "debug": false,
    "uri": [
        "QtQml.WorkerScript"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libworkerscriptplugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2plugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archlevel": 2,
    "className": "QtQuickControls2Plugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2plugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2macosstyleplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archlevel": 2,
    "className": "QtQuickControls2MacOSStylePlugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls.macOS"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2macosstyleplugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2basicstyleplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archlevel": 2,
    "className": "QtQuickControls2BasicStylePlugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls.Basic"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2basicstyleplugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2fusionstyleplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archlevel": 2,
    "className": "QtQuickControls2FusionStylePlugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls.Fusion"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2fusionstyleplugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquicktemplates2plugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
    "archlevel": 2,
    "className": "QtQuickTemplates2Plugin",
    "debug": false,
    "uri": [
        "QtQuick.Templates"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquicktemplates2plugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libquickwindowplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
    "archlevel": 2,
    "className": "QtQuick_WindowPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Window"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libquickwindowplugin.dylib" loaded library
qt.core.plugin.loader: Found metadata in lib /Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2fusionstyleimplplugin.dylib, metadata=
{
    "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
    "archlevel": 2,
    "className": "QtQuickControls2FusionStyleImplPlugin",
    "debug": false,
    "uri": [
        "QtQuick.Controls.Fusion.impl"
    ],
    "version": 395008
}


qt.core.library: "/Users/saz/Documents/Projects/qt-qml-cmake-testbed/build/Darwin-Release/qt-qml-cmake-testbed.app/Contents/PlugIns/libqtquickcontrols2fusionstyleimplplugin.dylib" loaded library
QQmlApplicationEngine failed to load component
qrc:/qt/qml/com/dsazonoff/testbed/main.qml:18:5: Type Wheel unavailable
qrc:/qt/qml/com/dsazonoff/wheel/Wheel.qml:4:1: module "QtQuick.Dialogs" is not installed


Update:

Нашёл интересный коммент: That's why there's an additional file in the actual app project (main) that does nothing but import all the modules that the library needs.
Отредактировано 29.11.2023 18:05 SaZ . Предыдущая версия .
Re: QML_ELEMENT + qt_add_qml_module
От: SaZ  
Дата: 08.12.23 12:18
Оценка: 3 (1)
Два момента, связанные с QML_ELEMENT:

1. Заголовочный файл должен находится в прямой видимости, то есть #include <MyElement.h> должен резолвиться — иначе не соберётся.
2. Если в проекте используются PCH для Qt, то надо явно подключать #include <QQmlEngine> в том файле где объявляете QML_ELEMENT — иначе не будет генерироваться код регистрации типа.
Отредактировано 08.12.2023 12:20 SaZ . Предыдущая версия . Еще …
Отредактировано 08.12.2023 12:19 SaZ . Предыдущая версия .
Re: Баги в qt_add_qml_module?
От: Skorodum Россия  
Дата: 11.03.24 14:56
Оценка: 2 (1)
Здравствуйте, SaZ, Вы писали:

У Qt новый пост про QML плагины вышел: Implicit Imports vs. QML Modules in Qt 6

Для себя сделал вывод, что переходить с 5.15 все еще рано... (при этом у нас плагины определены с помощью CMake).
Отредактировано 23.03.2024 11:13 SaZ (Исправлена ссылка) . Предыдущая версия .
qt qml qt5 qt6 cmak
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.