Changeset 6310

Show
Ignore:
Timestamp:
06/15/08 00:33:52 (3 months ago)
Author:
flynd
Message:

Make group expanded/collapsed state stay when resorting list. Also added workaround as sometimes groups would not expand after resorting was performed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/views/userview.cpp

    r6188 r6310  
    197197      { 
    198198        if (event->pos().x() <= 18) // we clicked an icon area 
    199           setExpanded(clickedItem, !isExpanded(clickedItem)); 
     199        { 
     200          bool wasExpanded = isExpanded(clickedItem); 
     201          setExpanded(clickedItem, !wasExpanded); 
     202 
     203          // setExpand may fail, for example after changing sorting an 
     204          // expanded group can be collapsed but sometimes cannot be expanded 
     205          // again. This was seen with Qt 4.4.0. 
     206          if (isExpanded(clickedItem) == wasExpanded) 
     207          { 
     208            // Setting expanded state to same state as view currently (falsely) 
     209            // reports seems to fix it, then set it again to the state we 
     210            // actually wanted, this times it works. 
     211            setExpanded(clickedItem, wasExpanded); 
     212            setExpanded(clickedItem, !wasExpanded); 
     213          } 
     214        } 
    200215      } 
    201216    } 
     
    301316    header()->setSortIndicator(column, order); 
    302317  } 
     318 
     319  // Group expansion gets confused when sorting is changed so refresh it 
     320  expandGroups(); 
    303321} 
    304322