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

Register QML types only when used

    XMLWordPrintable

Details

    Description

      Prototype following idea for new static_qml_type_registration config feature:

      QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent)
          : QQmlExtensionPlugin(parent)

      Unknown macro: { #if !QT_CONFIG(static_qml_type_registration)     volatile auto registration = &qml_register_types_QtQuick_Templates; #endif     volatile auto initialization = &QQuickTemplates_initializeModule;       Q_UNUSED(registration)     Q_UNUSED(initialization) }

      New function into plugin

      template <typedef T>

      registerPluginQmlType()

      {

       

        if ( validId != qMetaTypeId<T>())

       

      Unknown macro: {     qmlRegisterTypesAndRevisions<T>("plugin", version);   }

      }

      Then in each generated qmlcache file would do following for each used type. This is done during binary load - before aotBuiltFunctions is initialized.

      #if QT_CONFIG(jit_qml_type_registration)

          registerPluginQmlType<UsedType>()

      #endif

       

       

      This would save around 5KB per type (Atleast with qmlRegisterTypesAndRevisions<QQuickDelayButton>("QtQuick.Templates", 6)

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              jarihelaakoski Jari Helaakoski
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes