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

Provide a mechanism to annotate QML declarations

    XMLWordPrintable

Details

    Description

      Currently, the only way to change the UI declaration, layout and definition based on a precondition like e.g. the screen resolution is to either encode in states;

      State {
         name: "QVGA"
         when: width==320 && height==240
         PropertyChanges { ... }
      }
      

      or by using an exposed object to compare and declare the right value inline - e.g. for languages;

      Image {
         source: Qt.lang == Qt.it || Qt.RTL ? "foo_it_rtl.png" : "image.png"
         ...
      }
      

      One idea would be to provide an annotation mechanism in QML;

      Image {
         source = "image.png"
         source[lang=it, RTL]: "foo_it_rtl.png"
         width[default=123]: height+10
      }
      

      However, the syntax clutters QML and detracts readability.

      Attachments

        Activity

          People

            martinj Martin Jones
            hhartz Henrik Hartz (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: