Dash:
[t2-trunk.git] / target / desktop / pkg_qt.patch
blob74be43406823038c762eb909dc96409fd00fe2ca
1 --- ./src/iconview/qiconview.cpp 2004-08-05 11:42:00.000000000 -0300
2 +++ ./src/iconview/qiconview.cpp 2004-11-28 12:45:01.000000000 -0200
3 @@ -261,6 +261,7 @@ public:
5 QIconViewToolTip *toolTip;
6 QPixmapCache maskCache;
7 + QPixmap *backrubber;
8 QPtrDict<QIconViewItem> selectedItems;
10 struct ItemContainer {
11 @@ -1974,14 +1975,27 @@ void QIconViewItem::paintItem( QPainter
12 if ( picture() ) {
13 QPicture *pic = picture();
14 if ( isSelected() ) {
15 - p->fillRect( pixmapRect( FALSE ), QBrush( cg.highlight(), QBrush::Dense4Pattern) );
16 + p->setBrush( QBrush( cg.highlight(), QBrush::Dense4Pattern ) );
17 + p->setPen( QPen( cg.highlight(), QBrush::Dense4Pattern ) );
18 + p->drawRoundRect( pixmapRect( FALSE ),
19 + 1000 / pixmapRect( FALSE ).width(),
20 + 1000 / pixmapRect( FALSE ).height() );
22 p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic );
23 if ( isSelected() ) {
24 - p->fillRect( textRect( FALSE ), cg.highlight() );
25 + p->setBrush( QBrush( cg.highlight() ) );
26 + p->setPen( QPen( cg.highlight() ) );
27 + p->drawRoundRect( textRect( FALSE ),
28 + 1000 / textRect( FALSE ).width(),
29 + 1000 / textRect( FALSE ).height() );
30 p->setPen( QPen( cg.highlightedText() ) );
31 - } else if ( view->d->itemTextBrush != NoBrush )
32 - p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
33 + } else if ( view->d->itemTextBrush != NoBrush ) {
34 + p->setBrush( view->d->itemTextBrush );
35 + p->setPen( QPen( view->d->itemTextBrush.color() ) );
36 + p->drawRoundRect( textRect( FALSE ),
37 + 1000 / textRect( FALSE ).width(),
38 + 1000 / textRect( FALSE ).height() );
39 + }
41 int align = view->itemTextPos() == QIconView::Bottom ? AlignHCenter : AlignAuto;
42 if ( view->d->wordWrapIconText )
43 @@ -2039,10 +2053,19 @@ void QIconViewItem::paintItem( QPainter
45 p->save();
46 if ( isSelected() ) {
47 - p->fillRect( textRect( FALSE ), cg.highlight() );
48 + p->setBrush( QBrush( cg.highlight() ) );
49 + p->setPen( QPen( cg.highlight() ) );
50 + p->drawRoundRect( textRect( FALSE ),
51 + 1000 / textRect( FALSE ).width(),
52 + 1000 / textRect( FALSE ).height() );
53 p->setPen( QPen( cg.highlightedText() ) );
54 - } else if ( view->d->itemTextBrush != NoBrush )
55 - p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
56 + } else if ( view->d->itemTextBrush != NoBrush ) {
57 + p->setBrush( view->d->itemTextBrush );
58 + p->setPen( QPen( view->d->itemTextBrush.color() ) );
59 + p->drawRoundRect( textRect( FALSE ),
60 + 1000 / textRect( FALSE ).width(),
61 + 1000 / textRect( FALSE ).height() );
62 + }
64 int align = AlignHCenter;
65 if ( view->d->wordWrapIconText )
66 @@ -2058,31 +2081,13 @@ void QIconViewItem::paintItem( QPainter
67 /*!
68 Paints the focus rectangle of the item using the painter \a p and
69 the color group \a cg.
71 + The default implementation does nothing; subclasses may
72 + reimplement this function.
75 -void QIconViewItem::paintFocus( QPainter *p, const QColorGroup &cg )
76 +void QIconViewItem::paintFocus( QPainter *, const QColorGroup & )
78 - if ( !view )
79 - return;
81 - view->style().drawPrimitive(QStyle::PE_FocusRect, p,
82 - QRect( textRect( FALSE ).x(), textRect( FALSE ).y(),
83 - textRect( FALSE ).width(),
84 - textRect( FALSE ).height() ), cg,
85 - (isSelected() ?
86 - QStyle::Style_FocusAtBorder :
87 - QStyle::Style_Default),
88 - QStyleOption(isSelected() ? cg.highlight() : cg.base()));
90 - if ( this != view->d->currentItem ) {
91 - view->style().drawPrimitive(QStyle::PE_FocusRect, p,
92 - QRect( pixmapRect( FALSE ).x(),
93 - pixmapRect( FALSE ).y(),
94 - pixmapRect( FALSE ).width(),
95 - pixmapRect( FALSE ).height() ),
96 - cg, QStyle::Style_Default,
97 - QStyleOption(cg.base()));
98 - }
102 @@ -2778,6 +2783,7 @@ QIconView::QIconView( QWidget *parent, c
103 d->renamingItem = 0;
104 d->drawActiveSelection = TRUE;
105 d->drawDragShapes = FALSE;
106 + d->backrubber = 0;
108 connect( d->adjustTimer, SIGNAL( timeout() ),
109 this, SLOT( adjustItems() ) );
110 @@ -3262,7 +3268,7 @@ uint QIconView::count() const
112 void QIconView::doAutoScroll()
114 - QRect oldRubber = QRect( *d->rubber );
115 + QRect oldRubber = *d->rubber;
117 QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
118 QPoint pos = viewportToContents( vp );
119 @@ -3279,7 +3285,6 @@ void QIconView::doAutoScroll()
120 bool block = signalsBlocked();
122 QRect rr;
123 - QRegion region( 0, 0, visibleWidth(), visibleHeight() );
125 blockSignals( TRUE );
126 viewport()->setUpdatesEnabled( FALSE );
127 @@ -3305,9 +3310,6 @@ void QIconView::doAutoScroll()
128 item->setSelected( TRUE, TRUE );
129 changed = TRUE;
130 rr = rr.unite( item->rect() );
131 - } else {
132 - region = region.subtract( QRect( contentsToViewport( item->pos() ),
133 - item->size() ) );
136 minx = QMIN( minx, item->x() - 1 );
137 @@ -3324,42 +3326,76 @@ void QIconView::doAutoScroll()
138 viewport()->setUpdatesEnabled( TRUE );
139 blockSignals( block );
141 - QRect r = *d->rubber;
142 - *d->rubber = oldRubber;
144 - QPainter p;
145 - p.begin( viewport() );
146 - p.setRasterOp( NotROP );
147 - p.setPen( QPen( color0, 1 ) );
148 - p.setBrush( NoBrush );
149 - drawRubber( &p );
150 - d->dragging = FALSE;
151 - p.end();
153 - *d->rubber = r;
155 - if ( changed ) {
156 - d->drawAllBack = FALSE;
157 - d->clipRegion = region;
158 - repaintContents( rr, FALSE );
159 - d->drawAllBack = TRUE;
160 + // static bool drawAll;
161 + if ( d->backrubber == 0 ) {
162 + d->backrubber = new QPixmap( viewport()->rect().size() );
163 + d->backrubber->fill( viewport(), viewport()->rect().topLeft() );
164 + // drawAll = true;
167 + // int oldX = 0, oldY = 0;
168 + // if ( !drawAll && d->scrollTimer ) {
169 + // oldX = contentsX();
170 + // oldY = contentsY();
171 + // }
172 ensureVisible( pos.x(), pos.y() );
173 + // if ( !drawAll && d->scrollTimer && ( oldX != contentsX() || oldY != contentsY() ) )
174 + // drawAll = true;
176 - p.begin( viewport() );
177 - p.setRasterOp( NotROP );
178 - p.setPen( QPen( color0, 1 ) );
179 - p.setBrush( NoBrush );
180 - drawRubber( &p );
181 - d->dragging = TRUE;
182 + QRect allRect = oldRubber.normalize();
183 + if ( changed )
184 + allRect |= rr.normalize();
185 + allRect |= d->rubber->normalize();
186 + QPoint point = contentsToViewport( allRect.topLeft() );
187 + allRect = QRect( point.x(), point.y(), allRect.width(), allRect.height() );
188 + allRect &= viewport()->rect();
190 + d->dragging = FALSE;
192 + QPainter p( d->backrubber );
193 + p.translate( -contentsX(), -contentsY() );
194 +#if 0
195 + if ( !drawAll ) {
196 + oldRubber = oldRubber.normalize();
197 + point = contentsToViewport( oldRubber.topLeft() );
198 + oldRubber = QRect( point.x(), point.y(), oldRubber.width(), oldRubber.height() );
199 + oldRubber &= viewport()->rect();
201 + point = contentsToViewport( nr.topLeft() );
202 + nr = QRect( point.x(), point.y(), nr.width(), nr.height() );
203 + nr &= viewport()->rect();
205 + QRegion region;
206 + if ( allRect != nr )
207 + region = QRegion(allRect).subtract( QRegion( nr ) );
208 + if ( allRect != oldRubber )
209 + region += QRegion(allRect).subtract( QRegion( oldRubber ) );
211 + QMemArray< QRect > ar = region.rects();
212 + for ( uint i = 0; i < ar.size(); ++i ) {
213 + ar[i].addCoords( -2, -2, 4, 4 );
214 + ar[i] = ar[i].normalize();
216 + p.setClipRect( ar[i] );
217 + drawContents( &p, contentsX() + ar[i].left(), contentsY() + ar[i].top(), ar[i].width(), ar[i].height() );
220 + else
221 +#endif
222 + {
223 + drawContents( &p,
224 + contentsX() + allRect.left(), contentsY() + allRect.top(),
225 + allRect.width(), allRect.height() );
228 p.end();
229 + // drawAll = false;
230 + d->dragging = TRUE;
231 + bitBlt( viewport(), allRect.topLeft(), d->backrubber, allRect );
233 if ( changed ) {
234 - emit selectionChanged();
235 - if ( d->selectionMode == Single )
236 - emit selectionChanged( d->currentItem );
237 + if ( d->selectionMode == Single )
238 + emit selectionChanged( d->currentItem );
241 if ( !QRect( 50, 50, viewport()->width()-100, viewport()->height()-100 ).contains( vp ) &&
242 @@ -3386,9 +3422,7 @@ void QIconView::doAutoScroll()
244 void QIconView::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
246 - if ( d->dragging && d->rubber )
247 - drawRubber( p );
249 + p->save();
250 QRect r = QRect( cx, cy, cw, ch );
252 QIconViewPrivate::ItemContainer *c = d->firstContainer;
253 @@ -3462,8 +3496,16 @@ void QIconView::drawContents( QPainter *
254 d->currentItem->paintFocus( p, colorGroup() );
257 - if ( d->dragging && d->rubber )
258 - drawRubber( p );
259 + p->restore();
260 + if ( d->rubber ) {
261 + p->save();
262 + p->translate( contentsX(), contentsY() );
263 + p->setRasterOp( NotROP );
264 + p->setPen( QPen( color0, 1 ) );
265 + p->setBrush( NoBrush );
266 + drawRubber( p );
267 + p->restore();
272 @@ -4362,17 +4404,15 @@ void QIconView::contentsMousePressEvent(
273 void QIconView::contentsMousePressEventEx( QMouseEvent *e )
275 if ( d->rubber ) {
276 - QPainter p;
277 - p.begin( viewport() );
278 - p.setRasterOp( NotROP );
279 - p.setPen( QPen( color0, 1 ) );
280 - p.setBrush( NoBrush );
281 + QRect r( d->rubber->normalize() );
282 + delete d->rubber;
283 + d->rubber = 0;
285 + repaintContents( r, FALSE );
286 + d->dragging = FALSE;
288 - drawRubber( &p );
289 - d->dragging = FALSE;
290 - p.end();
291 - delete d->rubber;
292 - d->rubber = 0;
293 + delete d->backrubber;
294 + d->backrubber = 0;
296 if ( d->scrollTimer ) {
297 disconnect( d->scrollTimer, SIGNAL( timeout() ), this, SLOT( doAutoScroll() ) );
298 @@ -4557,21 +4597,17 @@ void QIconView::contentsMouseReleaseEven
299 d->startDragItem = 0;
301 if ( d->rubber ) {
302 - QPainter p;
303 - p.begin( viewport() );
304 - p.setRasterOp( NotROP );
305 - p.setPen( QPen( color0, 1 ) );
306 - p.setBrush( NoBrush );
308 - drawRubber( &p );
309 - d->dragging = FALSE;
310 - p.end();
312 + QRect r(d->rubber->normalize());
314 if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() >
315 QApplication::startDragDistance() )
316 emitClicked = FALSE;
317 delete d->rubber;
318 - d->rubber = 0;
319 + d->rubber = 0;
320 + repaintContents(r, FALSE);
321 + d->dragging = FALSE;
322 + delete d->backrubber;
323 + d->backrubber = 0;
324 d->currentItem = d->tmpCurrentItem;
325 d->tmpCurrentItem = 0;
326 if ( d->currentItem )
327 @@ -5330,9 +5366,9 @@ void QIconView::drawRubber( QPainter *p
328 QPoint pnt( d->rubber->x(), d->rubber->y() );
329 pnt = contentsToViewport( pnt );
331 - style().drawPrimitive(QStyle::PE_RubberBand, p,
332 - QRect(pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height()),
333 - colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()));
334 + style().drawPrimitive( QStyle::PE_RubberBand, p,
335 + QRect( pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height() ).normalize(),
336 + colorGroup(), QStyle::Style_Default, QStyleOption(colorGroup().base()) );
340 --- ./src/widgets/qlistbox.cpp 2004-10-15 20:25:57.000000000 -0300
341 +++ ./src/widgets/qlistbox.cpp 2004-10-17 04:14:49.000000000 -0300
342 @@ -2160,7 +2160,7 @@ void QListBox::mouseReleaseEvent( QMouse
345 if ( d->rubber ) {
346 - drawRubber();
347 + repaintContents( d->rubber->normalize(), FALSE );
348 delete d->rubber;
349 d->rubber = 0;
350 d->current = d->tmpCurrent;
351 @@ -2238,11 +2238,9 @@ void QListBox::mouseMoveEvent( QMouseEve
354 if ( d->rubber ) {
355 - QRect r = d->rubber->normalize();
356 - drawRubber();
357 + QRect r = d->rubber->normalize();
358 d->rubber->setCoords( d->rubber->x(), d->rubber->y(), e->x(), e->y() );
359 doRubberSelection( r, d->rubber->normalize() );
360 - drawRubber();
361 return;
364 @@ -4379,6 +4377,7 @@ void QListBox::drawRubber()
365 return;
366 if ( !d->rubber->width() && !d->rubber->height() )
367 return;
369 QPainter p( viewport() );
370 p.setRasterOp( NotROP );
371 style().drawPrimitive( QStyle::PE_RubberBand, &p, d->rubber->normalize(),
372 @@ -4411,13 +4410,24 @@ void QListBox::doRubberSelection( const
377 + QRect allRect = old;
378 + if ( changed ) {
379 + allRect |= pr;
380 + }
381 + allRect |= rubber;
382 + allRect &= viewport()->rect();
383 + allRect.addCoords( -2, -2, 2, 2 );
385 + repaintContents( QRect( contentsX() + allRect.left(), contentsY() + allRect.top(), allRect.width(), allRect.height() ), FALSE );
386 + drawRubber();
388 if ( changed ) {
389 emit selectionChanged();
390 #if defined(QT_ACCESSIBILITY_SUPPORT)
391 QAccessible::updateAccessibility( viewport(), 0, QAccessible::Selection );
392 #endif
394 - viewport()->repaint( pr, TRUE );