summaryrefslogtreecommitdiff
blob: dd78f5a79946479c8e31c668ca8990c60ead20b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
qt-bugs@ issue : 23151
applied: no
author: Pascal Létourneau <pletourn@globetrotter.net>

Fix the QRect().contains() test.
It was using the content pos instead of the viewport pos.
ensureVisible() use a default margin of 50px, this should be reflected in the 
construction of the QRect. 

Index: iconview/qiconview.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/iconview/qiconview.cpp,v
retrieving revision 1.47
diff -u -3 -p -r1.47 qiconview.cpp
--- src/iconview/qiconview.cpp	16 May 2003 13:02:38 -0000	1.47
+++ src/iconview/qiconview.cpp	30 May 2003 20:32:34 -0000
@@ -3257,9 +3258,11 @@ void QIconView::doAutoScroll()
 {
     QRect oldRubber = QRect( *d->rubber );
 
-    QPoint pos = QCursor::pos();
-    pos = viewport()->mapFromGlobal( pos );
-    pos = viewportToContents( pos );
+    QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
+    QPoint pos = viewportToContents( vp );
+
+    if ( pos == d->rubber->bottomRight() )
+      return;
 
     d->rubber->setRight( pos.x() );
     d->rubber->setBottom( pos.y() );
@@ -3352,15 +3355,14 @@ void QIconView::doAutoScroll()
 	if ( d->selectionMode == Single )
 	    emit selectionChanged( d->currentItem );
     }
-
-    if ( !QRect( 0, 0, viewport()->width(), viewport()->height() ).contains( pos ) &&
+    if ( !QRect( 50, 50, viewport()->width()-100, viewport()->height()-100 ).contains( vp ) &&
 	 !d->scrollTimer ) {
 	d->scrollTimer = new QTimer( this );
 
 	connect( d->scrollTimer, SIGNAL( timeout() ),
 		 this, SLOT( doAutoScroll() ) );
 	d->scrollTimer->start( 100, FALSE );
-    } else if ( QRect( 0, 0, viewport()->width(), viewport()->height() ).contains( pos ) &&
+    } else if ( QRect( 50, 50, viewport()->width()-100, viewport()->height()-100 ).contains( vp ) &&
 		d->scrollTimer ) {
 	disconnect( d->scrollTimer, SIGNAL( timeout() ),
 		    this, SLOT( doAutoScroll() ) );