3 # Patch managed by http://www.holgerschurig.de/patcher.html
6 --- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp~qiconview-speed
7 +++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.cpp
9 QIconView::SelectionMode selectionMode;
10 QIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor;
12 + QPixmap *backBuffer;
13 QTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer,
15 int rastX, rastY, spacing;
18 d->highlightedItem = 0;
23 d->tmpCurrentItem = 0;
28 + delete d->backBuffer;
33 @@ -2882,6 +2886,48 @@
37 + This function grabs all paintevents that otherwise would have been
38 + processed by the QScrollView::viewportPaintEvent(). Here we use a
39 + doublebuffer to reduce 'on-paint' flickering on QIconView
40 + (and of course its childs).
42 + \sa QScrollView::viewportPaintEvent(), QIconView::drawContents()
45 +void QIconView::bufferedPaintEvent( QPaintEvent* pe )
47 + QWidget* vp = viewport();
48 + QRect r = pe->rect() & vp->rect();
49 + int ex = r.x() + contentsX();
50 + int ey = r.y() + contentsY();
52 + int eh = r.height();
54 + if ( !d->backBuffer )
55 + d->backBuffer = new QPixmap(vp->size());
56 + if ( d->backBuffer->size() != vp->size() ) {
57 + //Resize function (with hysteesis). Uses a good compromise between memory
58 + //consumption and speed (number) of resizes.
59 + float newWidth = (float)vp->width();
60 + float newHeight = (float)vp->height();
61 + if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() )
64 + newHeight *= 1.1892;
65 + d->backBuffer->resize( (int)newWidth, (int)newHeight );
66 + } else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() )
67 + d->backBuffer->resize( (int)newWidth, (int)newHeight );
71 + p.begin(d->backBuffer, vp);
72 + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh);
74 + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh);
84 drawDragShapes( d->oldDragPos );
86 - viewportPaintEvent( (QPaintEvent*)e );
87 + bufferedPaintEvent ((QPaintEvent*)e );
90 drawDragShapes( d->oldDragPos );
91 @@ -5377,11 +5423,19 @@
94 if ( item->d->container1 && d->firstContainer ) {
95 - item->d->container1->items.removeRef( item );
96 + //Special-case checking of the last item, since this may be
97 + //called a few times for the same item.
98 + if (item->d->container1->items.last() == item)
99 + item->d->container1->items.removeLast();
101 + item->d->container1->items.removeRef( item );
103 item->d->container1 = 0;
104 if ( item->d->container2 && d->firstContainer ) {
105 - item->d->container2->items.removeRef( item );
106 + if (item->d->container2->items.last() == item)
107 + item->d->container2->items.removeLast();
109 + item->d->container2->items.removeRef( item );
111 item->d->container2 = 0;
113 --- qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h~qiconview-speed
114 +++ qt-2.3.10-snapshot-20050131/src/iconview/qiconview.h
116 virtual void contentsDropEvent( QDropEvent *e );
119 + void bufferedPaintEvent( QPaintEvent* );
120 virtual void resizeEvent( QResizeEvent* e );
121 virtual void keyPressEvent( QKeyEvent *e );
122 virtual void focusInEvent( QFocusEvent *e );