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

Timers are orphans

    XMLWordPrintable

Details

    • 5595ad768309b27c2c20376105f8715082b616bf

    Description

      This code

      Rectangle {
          width: 480; height: 800
          Item { id: item }
          Timer { interval: 1000; running: true;
              onTriggered: print("item's parent: " + item.parent.toString() +
                                 "\ntimer's parent: "+ parent.toString()); }
      }
      

      prints

      item's parent: QDeclarativeRectangle(0x8c9b4e8)
      timer's parent: null
      

      Changing the code to

      Rectangle {
          width: 480; height: 800
          Item { id: item }
          Timer { id: timer; interval: 1000; running: true;
              onTriggered: print("item's parent: " + item.parent.toString() +
                                 "\ntimer's parent: "+ timer.parent.toString()); }
      }
      

      prints

      TypeError: Result of expression 'timer.parent' [undefined] is not an object.
      

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes