Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-200

Timer: set to "running" with property binding, the timer never starts again in some situation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • Qt for MCUs 2.6
    • Qt for MCUs 2.5.1
    • QA Team, QML, QUL Team
    • None
    • All
    • 7af9138dd13658a81e329f02dd406556282624a5

    Description

      This problem is that if you bind a bool property to running and manipulate True or False from the outside, the timer will never work again.

      The following program binds the active property to running.
      If you swap the active's true and false in the switch element, the timer will not work from the second time.

      Rectangle {
          id : rect
          property bool active:false
      
          Timer {
              id: timer
              running: rect.active
              interval: 500
              onTriggered: {
                  // if the running property evaluates to false on Triggered,
                  // the "running" property will have never been to set true again even if the binded property is true.
                  rect.active = false
                  console.log("fire")
              }
          }
          Switch {
              anchors.bottom: parent.bottom
              onClicked: {
                  rect.active = checked
              }
          }
      }

      P.S.

      the repeat is true, the timer starts again except the above triggered comments.

      if the repeat is false, the timer never starts again.

      Attachments

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

        Activity

          People

            tonyl Tony Leinonen
            wataru Wataru Higashiyama
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes