Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › Refresh Flickable

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4373

    phil.jahoda

    In a Scene, we are using a Flickable that is displaying a Colum with TextViews (TextViews are in Repeater).

    The TextViews display data that is read from the settings when the Flickable is first created.

     

    WIthin that Scene, the users actions can cause a change in the values stored in the settings. In that case, I want to refresh the repeater as well, how is that possible?

    #4374

    Christian
    Felgo Team

    Hi,

    could you post the relevant source code please?

    Cheers, Chris

    #4375

    phil.jahoda

    Whenever I say player.loadHighscore() i access the settings.

     

    import VPlay 1.0
    import QtQuick 1.1
    
    Scene {
    
      Flickable {
    
        id: flickable
        x: -200
        y: 20
    
        width: parent.width / 2
        height: parent.height
    
        contentWidth: column.width
        contentHeight: column.height
        flickableDirection: Flickable.VerticalFlick
    
        // The duration of the slide animation for this button
        property int slideDuration: 800
    
        Column {
    
          id: column
          spacing: 5
          anchors.centerIn: parent
    
          Repeater {
            id: repeater
            model: window.numberoflevels
    
            MenuButton {
              text: getHighScoreText(modelData + 1);
              source: "img/cloud.png"
                      textSize: 10
              fontBold: true
            }
          }
        }
    
        Behavior on x {
          SmoothedAnimation { duration: 800; easing.type: Easing.InOutQuad }
        }
    
        function slideIn() {
          x = parent.width - flickable.width
        }
    
        function slideOut() {
          x = -200
        }
      }
    
      function getHighScoreText(modelData) {
        return "Level " + (modelData) + " – Score:" + " " + player.loadHighScore("0"+(modelData));
        //+ “, Remaining Arrows: ” + player.loadRemArrows(“0″+(modelData));
      }
    
      // THE BELOW CODE IS NOT WORKING
      function update() {
    
        for(var i = 0; i < window.numberoflevels; i++) {
    
          repeater.childAt(i).text = getHighScoreText(i+1);
        }
      }
    
      // an so on…
    }
    

     

    #4377

    Christian
    Felgo Team

    Hi,

    instead of modifying the modelData property, which is read-only I think, you could change your code so it works correctly with the Repeater element. As the doc of Repeater element is saying, you could change your model to an array of strings or integer values, to something like [“123”, “456”, “789”] where each of the elments holds the scores for a level.

    Note: please use the Code button, so the code is easier to read and correctly formatted with indentation.

    Cheers, Chris

    #4382

    phil.jahoda

    Thank you for your response, I will try that.

    PS: I am always using the “Code” button, and then I strg+v my code. Unfortunately it doesnt seem to work or I dont see what I am doing wrong 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded