Show
Ignore:
Timestamp:
04/05/08 20:08:59 (8 months ago)
Author:
eugene
Message:

Don't query the model each time.

Files:
1 modified

Legend:

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

    r6128 r6129  
    143143void UserView::setGroupSpanning() 
    144144{ 
    145   int rows = model()->rowCount(rootIndex()); 
    146  
    147   if (rootIndex().isValid()) 
     145  QModelIndex root = rootIndex(); 
     146  int rows = model()->rowCount(root); 
     147 
     148  if (root.isValid()) 
    148149  { 
    149150    // Single group (non-threaded) view - bars are sorted with contacts 
    150151    for (int i = 0; i < rows; ++i) 
    151       if (model()->data(model()->index(i, 0, rootIndex()), ContactListModel::ItemTypeRole).toUInt() == ContactListModel::BarItem) 
    152         setFirstColumnSpanned(i, rootIndex(), true); 
     152      if (model()->data(model()->index(i, 0, root), ContactListModel::ItemTypeRole).toUInt() == 
     153          ContactListModel::BarItem) 
     154        setFirstColumnSpanned(i, root, true); 
    153155  } 
    154156  else 
     
    156158    // Full tree (threaded) view - all top level items are groups 
    157159    for (int i = 0; i < rows; ++i) 
    158       setFirstColumnSpanned(i, rootIndex(), true); 
     160      setFirstColumnSpanned(i, root, true); 
    159161  } 
    160162}