Changeset 6130 for trunk/qt4-gui/src/views
- Timestamp:
- 04/05/08 21:55:21 (8 months ago)
- Location:
- trunk/qt4-gui/src/views
- Files:
-
- 2 modified
-
userview.cpp (modified) (3 diffs)
-
userview.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/views/userview.cpp
r6129 r6130 127 127 header()->hide(); 128 128 129 s etGroupSpanning();129 spanRowRange(rootIndex(), 0, model()->rowCount(rootIndex()) - 1); 130 130 } 131 131 … … 141 141 } 142 142 143 void UserView::setGroupSpanning() 144 { 145 QModelIndex root = rootIndex(); 146 int rows = model()->rowCount(root); 147 148 if (root.isValid()) 149 { 150 // Single group (non-threaded) view - bars are sorted with contacts 151 for (int i = 0; i < rows; ++i) 152 if (model()->data(model()->index(i, 0, root), ContactListModel::ItemTypeRole).toUInt() == 153 ContactListModel::BarItem) 154 setFirstColumnSpanned(i, root, true); 155 } 156 else 157 { 158 // Full tree (threaded) view - all top level items are groups 159 for (int i = 0; i < rows; ++i) 160 setFirstColumnSpanned(i, root, true); 143 void UserView::spanRowRange(const QModelIndex& parent, int start, int end) 144 { 145 for (int i = start; i <= end; i++) 146 { 147 // get the real model index 148 QModelIndex index = model()->index(i, 0, parent); 149 unsigned itemType = model()->data(index, ContactListModel::ItemTypeRole).toUInt(); 150 151 if (itemType == ContactListModel::GroupItem || 152 itemType == ContactListModel::BarItem) 153 setFirstColumnSpanned(i, parent, true); 161 154 } 162 155 } … … 179 172 setFrameStyle(Config::Skin::active()->frame.frameStyle); 180 173 UserViewBase::applySkin(); 174 } 175 176 void UserView::rowsInserted(const QModelIndex& parent, int start, int end) 177 { 178 spanRowRange(parent, start, end); 179 UserViewBase::rowsInserted(parent, start, end); 181 180 } 182 181 -
trunk/qt4-gui/src/views/userview.h
r5916 r6130 85 85 virtual void applySkin(); 86 86 87 /** 88 * Overload the base class so we can analyze the rows 89 * which were inserted and act accordingly 90 * 91 * @param parent The view index which was populated 92 * @param start The number of the first inserted row 93 * @param end The number of the last inserted row 94 */ 95 virtual void rowsInserted(const QModelIndex& parent, int start, int end); 96 87 97 private: 88 98 /** … … 108 118 109 119 /** 110 * Set group spanning for header rows 120 * Sets row spanning for particular rows in the given group 121 * 122 * @param parent The view index to analyze 123 * @param start The count of the first row 124 * @param end The count of the last row 111 125 */ 112 void s etGroupSpanning();126 void spanRowRange(const QModelIndex& parent, int start, int end); 113 127 114 128 private slots:
