Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16478 QtScript API changes for Qt 5
  3. QTBUG-16479

Get rid of invalid QScriptValue type

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Invalid
    • Not Evaluated
    • 5.0.0
    • Qt Script
    • None

    Description

      In Qt 4, default-constructed QScriptValues are invalid (QScriptValue::isValid() returns false).

      Invalid values are used as a form of error reporting:
      QScriptValue::call() returns an invalid value if invoked on a non-callable.
      QScriptValue::property() returns an invalid value if the property doesn't exist.

      Additionally, an invalid value can be used to delete a property, by calling QScriptValue::setProperty() with an invalid value as argument.

      JavaScript has no concept of invalid values. When an invalid value is returned back to JS (for example, as the result of a native function call), the value is implicitly converted to undefined.

      It would be nice to get rid of the whole concept of invalid values, and have them become undefined values instead.
      Some additional API must be introduced to enable this, such as QScriptValue::hasOwnProperty() to determine if a property exists, and QScriptValue::deleteProperty() to enable property deletion.

      Attachments

        Issue Links

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

          Activity

            People

              kenthans Kent Hansen (Inactive)
              kenthans Kent Hansen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes