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

Improve support for matrix and vector types in QML

    XMLWordPrintable

Details

    Description

      Support in QML for types commonly used in QML/3D (and in particular, matrix and vector types) could be improved by reducing conversion overhead costs, and/or by making some changes or additions to the associated value-type classes.

      More concretely, some ideas so far:

      1) Adding support for QList<qreal> and QList<int> (DONE - see QTBUG-20826)

      2) Adding some Q_INVOKABLE methods to QDeclarativeMatrix4x4ValueType and the various vector-related value type classes, for common operations (multiplication, addition, dotproduct, etc) (DONE - see 42f9444e983b5257241c17242471ca63f208c3f6)

      3) Adding a LinearAlgebra Module API with built-in factory functions for producing rotated, scaled or otherwise transformed matrices given some inputs, as well as methods to perform common functionality (NOT DONE - this would be relatively simple to add in 5.1)

      4) Allow assigning a JS Array to a Q_PROPERTY whose type is a vector or matrix, by checking the typehint and attempting to build the appropriate C++ value type from the generated QList<qreal> (NOT DONE - we looked at this, and decided not to implement it, as it is not very JavaScript-like. Instead, we added constructor functions like Qt.matrix4x4() which can take a JavaScript array as an argument).

      5) Improve typehinting for value-types by adding to the property syntax of QML for the various value types (eg, property vector3d someVec3) to allow (4) to work for dynamic properties as well as Q_PROPERTYs (DONE - see QTBUG-21034 and QTBUG-18217)

      6) Improve sequence conversion performance by using Array as the prototype and implementing directly against QList<> for the hinted type (DONE for non-valuetype types such as int, qreal, bool etc - but this may need to be looked at in the future - we should unify list<> properties, and use a model rather than a QList exposed, to allow sparse arrays, etc)

      This JIRA Suggestion exists purely to collect ideas and input, and in no way implies that any of the above ideas are going to be implemented or are even possible to implement.

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes