Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39462

cmake: static qml plugins not registered automatically on osx without a non-namespaced build

    XMLWordPrintable

Details

    • macOS

    Description

      when trying to use qml plugins in a statically linked application, i figured that i need to registerTypes/initializeEngine explicitly on osx when not using namespaces.

      as a workaround, i currently have the following code in my application:

      #if defined(QT_STATIC) && !defined(Q_OS_MAC) && !defined(QT_NAMESPACE)
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())       ->registerTypes("QtQuick");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Private");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Styles");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickLayoutsPlugin().instance()) ->registerTypes("QtQuick.Layouts");
      
      [...]
      
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())       ->initializeEngine(engine, "QtQuick");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->initializeEngine(engine, "QtQuick.Controls");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickLayoutsPlugin().instance()) ->initializeEngine(engine, "QtQuick.Layouts");
      
      #endif
      

      would be great if it could be fixed so that Q_IMPORT_PLUGIN is enough on all platforms/namespace configurations

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andysh Andy Shaw
            timblechmann tim blechmann
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes