Results 1 to 9 of 9

Thread: repeater polish() loop on ios

  1. #1
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default repeater polish() loop on ios

    Hi Qt Masters,

    I am having error polish() loop in iOS when binding image source using repeater.
    However no such error appeared when building it in Android.
    When I tried debugging (putting logs), found out that the repeater populates the image row twice then loop error, which made me conclude that the error is due to repeater population.
    I can't find any error in the code which triggers the display of the image row twice or more.
    Is there a way to limit the repeater to populate only once on first display?
    Except when there is mouse interaction because new image source will be displayed.
    Thanks in advance.

    Qt Code:
    1. Item
    2. {
    3. id: root
    4.  
    5. property int currLevel: 1
    6. property bool disabled: currLevel <= 0
    7.  
    8. Layout.fillWidth: true
    9.  
    10. implicitHeight: row.implicitHeight
    11. implicitWidth: row.implicitWidth
    12.  
    13. Row {
    14. id: row
    15. anchors.fill: parent
    16.  
    17. Repeater
    18. {
    19. id:repeater
    20.  
    21. model: 10
    22.  
    23. Image {
    24. id: img
    25.  
    26. function urlForState(disabled, hover, active) {
    27. if(disabled && active) return "img-disabled.png"
    28. if(disabled) return "img-off.png"
    29.  
    30. if (active) {
    31. if (hover) return "img-on-over.png"
    32. return "img-on.png"
    33. } else {
    34. if (hover) return "img-off-over.png"
    35. return "img-off.png"
    36. }
    37. }
    38.  
    39. width: row.width/model
    40. fillMode: Image.PreserveAspectFit
    41.  
    42. source: urlForState(root.disabled, mouseArea.pressed, root.currLevel > index)
    43. }
    44. }
    45. }
    46.  
    47. MouseArea
    48. {
    49. id: mouseArea
    50.  
    51. anchors.fill: parent
    52.  
    53. hoverEnabled: true
    54. }
    55. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by joko; 10th March 2015 at 15:27.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: repeater polish() loop on ios

    What is the error you are getting?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: repeater polish() loop on ios

    Quote Originally Posted by wysota View Post
    What is the error you are getting?
    Thanks for the quick reply wysota.

    The errors appeared on the application output were few lines of this:

    QQuickWindow: possible QQuickItem:: polish() loop

    Then the page will froze.


    Added after 1 17 minutes:


    After carefully examining my code, i found out the reason why repeater populates the row twice because I set the "currLevel = 1" then the parent of the element, set the currLevel on Component.oncompleted. So the first instance of the population of images was based on the initial value, then re-populate again once oncompleted signal is called.

    Any advice how to simplify it? And also, any idea why this only occurred on iOS compiler? TIA.
    Last edited by joko; 10th March 2015 at 17:43.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: repeater polish() loop on ios

    Set the repeater's model in Component.onCompleted when currLevel is already set.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: repeater polish() loop on ios

    Quote Originally Posted by wysota View Post
    Set the repeater's model in Component.onCompleted when currLevel is already set.
    That didn't resolved the issue though it only populates the repeater delegate once.
    However after emitting the width property on Image component, the loop error disappeared.
    Setting the width on image equally placed them on the center (in Android) while in iOS without setting the width, they're placed on the center already.

    Is there a known issue like this in iOS? Thanks.

  6. #6
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: repeater polish() loop on ios

    Hi again,

    I am having an error when the row width changes, do you have any advise how to set the image width within the repeater?
    I tried creating a variable that will handle the img width, which will be set once onWidthChanged signal of the row, but the same error.
    And also tried creating a javascript binded to img component which will return row.width/model.
    Thanks.

    ERROR:
    I/dalvikvm(10614): threadid=3: reacting to signal 3
    I/dalvikvm(10614): Wrote stack traces to '/data/anr/traces.txt'


    Qt Code:
    1. Item
    2. {
    3. id: root
    4.  
    5. Layout.fillWidth: true
    6.  
    7. implicitHeight: row.implicitHeight
    8. implicitWidth: row.implicitWidth
    9.  
    10. Row {
    11. id: row
    12. anchors.fill: parent
    13.  
    14. Repeater
    15. {
    16. id:repeater
    17.  
    18. model: 10
    19.  
    20. Image {
    21. id: img
    22.  
    23. width: row.width/model // this is the line of code that is causing the problem
    24. fillMode: Image.PreserveAspectFit
    25.  
    26. source: "img.png"
    27. }
    28. }
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by joko; 13th March 2015 at 15:18.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: repeater polish() loop on ios

    I don't understand what you mean. What row width changes do you mean?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: repeater polish() loop on ios

    Quote Originally Posted by wysota View Post
    I don't understand what you mean. What row width changes do you mean?
    The row component which is the parent of the Repeater is what I am referring to.
    I think the issue occurred when its width changes (once orientation changes) and when the repeater populates the images using this equation "row.width/model", am I right?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: repeater polish() loop on ios

    The code doesn't look suspicious. It should work without problems.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. PropertyChanges on repeater elements
    By joko in forum Qt Quick
    Replies: 4
    Last Post: 15th October 2014, 12:36
  2. Performance Issue When Using Repeater
    By alizadeh91 in forum Qt Quick
    Replies: 7
    Last Post: 24th July 2012, 15:04
  3. QTranslator and polish signs
    By damon_1990 in forum Newbie
    Replies: 0
    Last Post: 11th December 2011, 23:04
  4. Replies: 4
    Last Post: 6th August 2011, 02:40
  5. Replacing polish diacritics in the string
    By kornicameister in forum Qt Programming
    Replies: 3
    Last Post: 8th February 2011, 16:54

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.