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

Inconsistent handling of property initialisation vs binding

    XMLWordPrintable

Details

    Description

      There are several cases in which an initialisation together with property declaration is not allowed, but a subsequent binding is ok.

      I fear this is due to inconsistencies arising in the grammar, but currently

      type with <> -> initialisation is expected to be an object list

      type without <> -> initialisation can be object or sort expression.

      default and required and readonly limit this further.

      If no inconsistency arises then I feel that we should (from the grammar point of view) always allow all kind of initialisations, and warn later about them.

      The current state requires strange checks (see https://codereview.qt-project.org/c/qt/qtdeclarative/+/373578 ) Some of the non allowed things in the initialisation are (but allowed when split) are:

      property list<Item> myList: Item{}
      property var arrayNoMerge: [Item {}, Item\{ nr: 2 }]
      default property list<Item> nonMergeable: [Item {}, Item\{ nr: "II" }]

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            fawzi Fawzi Mohamed
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes