Changeset 2921 for vidalia/trunk
- Timestamp:
- 08/02/08 20:35:46 (4 months ago)
- Location:
- vidalia/trunk/src/vidalia/log
- Files:
-
- 2 modified
-
logtreewidget.cpp (modified) (3 diffs)
-
logtreewidget.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vidalia/trunk/src/vidalia/log/logtreewidget.cpp
r2362 r2921 29 29 /* Default to always scrolling to the most recent item added */ 30 30 _scrollOnNewItem = true; 31 connect(verticalScrollBar(), SIGNAL(valueChanged(int)), 32 this, SLOT(onVerticalScroll(int))); 31 setVerticalScrollMode(QAbstractItemView::ScrollPerItem); 32 connect(verticalScrollBar(), SIGNAL(sliderReleased()), 33 this, SLOT(verticalSliderReleased())); 33 34 } 34 35 … … 38 39 * probably looking at something in their history. */ 39 40 void 40 LogTreeWidget::onVerticalScroll(int value) 41 { 42 QScrollBar *scrollbar = verticalScrollBar(); 43 _scrollOnNewItem = (value >= (scrollbar->maximum()-scrollbar->singleStep())); 41 LogTreeWidget::verticalSliderReleased() 42 { 43 QScrollBar *scrollBar = verticalScrollBar(); 44 if (header()->sortIndicatorOrder() == Qt::AscendingOrder) 45 _scrollOnNewItem = (scrollBar->value() == scrollBar->maximum()); 46 else 47 _scrollOnNewItem = (scrollBar->value() == scrollBar->minimum()); 44 48 } 45 49 … … 183 187 } 184 188 185 /* Add the new message item and scroll to it (if necessary) */ 189 /* Add the new message item and scroll to it (if necessary) 190 * NOTE: We disable sorting, add the new item, and then re-enable sorting 191 * to force the result to be sorted immediately. Otherwise, the new 192 * message is not sorted until the message log has focus again. 193 */ 194 setSortingEnabled(false); 186 195 addMessageItem(item); 196 setSortingEnabled(true); 197 187 198 if (_scrollOnNewItem) { 188 scrollToItem(item); 189 } 199 QScrollBar *scrollBar = verticalScrollBar(); 200 if (header()->sortIndicatorOrder() == Qt::AscendingOrder) 201 scrollBar->setValue(scrollBar->maximum()); 202 else 203 scrollBar->setValue(scrollBar->minimum()); 204 } 205 190 206 return item; 191 207 } -
vidalia/trunk/src/vidalia/log/logtreewidget.h
r2362 r2921 77 77 private slots: 78 78 /** Called when the user moves the vertical scroll bar. */ 79 void onVerticalScroll(int value);79 void verticalSliderReleased(); 80 80 81 81 private:
