Results 1 to 4 of 4

Thread: [ItemView] Bug in headerview

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [ItemView] Bug in headerview

    Hi
    I found a bug in the handling of column removal by headerview.
    I found also the code error that give that mishandling.
    The case :
    3 columns, say A, B, C.
    Move column C to first place. -> C,A,B.
    Then remove column A -> Boom. Normally should get C,B

    the current code :
    Qt Code:
    1. for (int l = logicalLast; l >= logicalFirst; --l) {
    2. int visual = visualIndices.at(l);
    3. int size = sections.at(visual + 1).position - sections.at(visual).position;
    4. for (int v = 0; v < sections.count(); ++v) {
    5. if (logicalIndex(v) > l)
    6. --(logicalIndices[v]);
    7. if (v > visual) {
    8. sections[v].position -= size;
    9. int logical = logicalIndex(v);
    10. --(visualIndices[logical]);
    11. }
    12. }
    13. sections.remove(visual);
    14. hiddenSectionSize.remove(l);
    15.  
    16. logicalIndices.remove(visual);
    17. visualIndices.remove(l);
    To copy to clipboard, switch view to plain text mode 
    line 9/10 use value that line 7 may have changed.
    it should be (80% sure ) :
    Qt Code:
    1. for (int l = logicalLast; l >= logicalFirst; --l) {
    2. int visual = visualIndices.at(l);
    3. int size = sections.at(visual + 1).position - sections.at(visual).position;
    4. for (int v = 0; v < sections.count(); ++v) {
    5. int logical = logicalIndex(v);
    6. if (logicalIndex(v) > l)
    7. --(logicalIndices[v]);
    8. if (v > visual) {
    9. sections[v].position -= size;
    10. --(visualIndices[logical]);
    11. }
    12. }
    13. sections.remove(visual);
    14. hiddenSectionSize.remove(l);
    15.  
    16. logicalIndices.remove(visual);
    17. visualIndices.remove(l);
    To copy to clipboard, switch view to plain text mode 

    What is the quickest way to get an official fix for that ?

    I'm trying to recollect how to recompile Qt here
    (I have already done it for 4.1.2)

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: [ItemView] Bug in headerview

    Quote Originally Posted by lauranger
    What is the quickest way to get an official fix for that ?
    "Open a new Task" at Task Tracker.
    J-P Nurmi

  3. #3
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: [ItemView] Bug in headerview

    Ick... this code is so hard to read, I'm not surprised it has a bug. Nested loops using vectors like fixed-size arrays... ugh. Granted, organizing the header section probably isn't a UI operation that needs to be done too often, probably just on init, I imagine they did it for performance reasons for other view operations.
    Software Engineer



  4. #4
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [ItemView] Bug in headerview

    I agree with you. We can consider it too "clever" for the frequency it is to be called.
    I guess calculating just the visual indexes and then mapping back the logical indexes
    would have suffice.

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.