Results 1 to 4 of 4

Thread: Spurious "Binding loop detected" warnings [solved]

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Spurious "Binding loop detected" warnings [solved]

    I have a qml item that presents a stimulus (image and sound) on the screen on a timer.
    So I have a stimulus state as such:
    Qt Code:
    1. State {
    2. name: "stimulus"
    3. extend: "running"
    4. PropertyChanges {
    5. target: getStimulus()
    6. explicit: true
    7. present: true
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

    This state is entered when a timer fires. The getStimulus() function returns the stimulus item that I would like to present. It looks like this:
    Qt Code:
    1. function getStimulus() {
    2. console.log("GetStimulus() currIndex: "+currIndex+" value: "+sequence[currIndex])
    3. var stimIndex = 0
    4. if(sequence[currIndex] === 0) {// non-target
    5. stimIndex = 1+Math.floor(Math.random()*(stimuli.children.length-1))
    6. }
    7. return stimuli.children[stimIndex]
    8. }
    To copy to clipboard, switch view to plain text mode 

    As you can see, when the sequence of stimuli specifies a distractor stimulus, the function chooses a random one amongst the children of an Item that holds them.

    This works perfectly with no warnings.

    However now I want to prevent the same distractor stimulus being shown twice in a row. So I did this:

    Qt Code:
    1. function getStimulus() {
    2. console.log("GetStimulus() currIndex: "+currIndex+" value: "+sequence[currIndex])
    3. var stimIndex = 0
    4. if(sequence[currIndex] === 0) {// non-target
    5. do { // FIXME this prints out spurious "Binding loop detected" warnings. Could rewrite by picking the index out of an array and removing the previous one.
    6. stimIndex = 1+Math.floor(Math.random()*(stimuli.children.length-1))
    7. } while (stimIndex === lastStimIndex);
    8. lastStimIndex = stimIndex
    9. }
    10. return stimuli.children[stimIndex]
    11. }
    To copy to clipboard, switch view to plain text mode 

    This works exactly as I want it to, however on the console it prints out: QML PropertyChanges: Binding loop detected for property "target"
    Not really a functionality problem, but this is very annoying. How do I avoid this warning? There is no actual binding loop here, there just happens to be a loop in the function to find the target.

    Oddly enough, when I rewrote the function with an alternate method based on selecting the index out of an array, the binding loop warning is still there.
    Last edited by pherthyl; 24th May 2013 at 23:16.

Similar Threads

  1. Replies: 3
    Last Post: 29th April 2010, 19:11
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. "Warnings" with NMake and MSVC2008
    By vbman213 in forum Newbie
    Replies: 6
    Last Post: 14th February 2010, 00:44
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.