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

Add support for registering value type to QML engine

    XMLWordPrintable

Details

    Description

      Introducing qmlRegisterValueType() would be very useful under some circumstances and may unify the built-in types implementation in current QML engine, e.g:

      // MyControl.qml

      import QtQuick 2.12
      import QtQuick.Controls 2.12 as C
      
      Item {
          property C.IconValueType icon
      }

      We can also use the constructors that are marked with Q_INVOKABLE to initialize a value type property:

      import QtQuick.Controls 2.12 as C
      
      MyControl {
      
          icon: "icon1" // implicit type casting provided by constructor
      
          // a better Qt.icon() approach
          Component.onCompleted: icon = new C.IconValueType("icon2", 16, 16)
      }

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              gpbeta Joshua GPBeta
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes