XMLWordPrintable

    Details

    • Type: Technical task
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Fix Version/s: 6.5
    • Component/s: QML: Tooling
    • Labels:

      Description

      qmllint (current dev) suggests to replace "var" property with function,
      for code bellow.

      Property "nextCheckState" is a variant property. It may or may not be a method. Use a regular function instead.
      

      But this suggestion have no sense for me.

      QML doesn't support function "override" in the same manner as C++, hence to allow user change part of logic of your component this logic should be inside property,
      and only "var" type is allowed if you want to save "function() {}" inside property.
      So how it possible to "use regular function instead" in such case ?

      Rectangle {
          id: control
      
          property var nextCheckState: function(prevState) {
              return !prevState;
          }
      
          BoolValue {
              id: flag
          }
         MouseArea {
              anchors.fill: parent
              onClicked: {
                  flag.setOn(control.nextCheckState(flag.isOn));
              }
          }
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            qtqmlteam Qt Qml Team User
            Reporter:
            evgeniy_dushistov evgeniy_dushistov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes