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

Strong typing - Make QtQuickView APIs strongly typed

XMLWordPrintable

    • Icon: User Story User Story
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 6.8.0 FF, 6.8.0 Beta2
    • None
    • Quick: Other
    • None
    • Android
    • 2024wk18FOQtforAndroid, 2024wk20s2FOQtforAndroid, 2024wk22s2FOQtforAndroid, 2024wk24s2FOQtforAndroid, 2024wk26s2FOQtforAndroid, 2024wk28s2FOQtforAndroid, 2024wk30s2FOQtforAndroid
    • 4f4160fb6 (dev), 7282c54fe (dev), 876991d8b (dev), afd1bb021 (dev), 3cdf282d9 (dev), a8007cc3d (dev)

      Why?

      All current (6.7) QtQuickView communication APIs (set/get/connect) have String based parameters: property names and signal names.

      It is error prone and works against decoupling of QML project and Java project. Changes in QML project, can break the Java project without development time or compile time errors.  **  

      How?

      As the metatype information is available after building the QML project, one possible solution is to generate Java classes that carry required metatype info. The user will be able to pass those types as "properties" or "signals" instead of Strings.

      // Before
      qtQuickView.setProperty("rotation", 10.0);
      

      Becomes:

      // After
      qtQuickView.setProperty(AppModule.Properties.rotation, 10.0);
      

      where the AppModule.Properties is a java class, and rotation can be another class or even again a String field (if String, that keeps the method signature intact).

      Edit Note: T

       

        For Gerrit Dashboard: QTBUG-124846
        # Subject Branch Project Status CR V

            soarmin Soheil Armin
            soarmin Soheil Armin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: