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

QML Item::mapToItem parameter count not checked

    XMLWordPrintable

Details

    • b9ff90423879c9b27d049b47b1b19a6695878ccd

    Description

      The number of arguments in QML function Item::mapToItem is not checked properly. The documentation defines a 3 parameter and a 5 parameter signature.

      When you use 2 or 4 parameters, the behaviour is undefined but no error is shown. This is caused by a vague case distinction in QQuickItem::mapToItem(QQmlV4Function *args)

      qtdeclarative/src/quick/items/qquickitem.cpp
      // Line 3983
              if (args->length() > 3) {
                  // case A
              } else {
                  // case B
              }
      

      This is especially problematically because the QML function can be confused with the C++ function QQuickItem::mapToItem(const QQuickItem *, const QPointF &).

      See also problem description on Stack Overflow.

      The same goes for mapFromItem

      Attachments

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

        Activity

          People

            shausman Simon Hausmann
            webmaster128 Simon Warta
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes