summaryrefslogtreecommitdiffstats
path: root/experimental/tqtinterface/qt4/src/iconview
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-23 17:13:36 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-23 17:13:36 -0500
commit2f4ee8ef5d1fe9a8daa9d342d71b021e6a25ca01 (patch)
treec7c69fbe21ff704ebb8cf74b25627111ed30efdd /experimental/tqtinterface/qt4/src/iconview
parent5584c3586a63c9e18513e8df2d6823ec6b33dfc7 (diff)
downloadtde-2f4ee8ef5d1fe9a8daa9d342d71b021e6a25ca01.tar.gz
tde-2f4ee8ef5d1fe9a8daa9d342d71b021e6a25ca01.zip
Apply all Qt3.3.8d patches
NOTE: This will *likely* break compilation of TQt4 Please wait a few days for fixes to be committed as needed!
Diffstat (limited to 'experimental/tqtinterface/qt4/src/iconview')
-rw-r--r--experimental/tqtinterface/qt4/src/iconview/tqiconview.cpp208
1 files changed, 123 insertions, 85 deletions
diff --git a/experimental/tqtinterface/qt4/src/iconview/tqiconview.cpp b/experimental/tqtinterface/qt4/src/iconview/tqiconview.cpp
index e95ff47b6..08ab4bd80 100644
--- a/experimental/tqtinterface/qt4/src/iconview/tqiconview.cpp
+++ b/experimental/tqtinterface/qt4/src/iconview/tqiconview.cpp
@@ -264,6 +264,7 @@ public:
TQIconViewToolTip *toolTip;
TQPixmapCache maskCache;
+ TQPixmap *backrubber;
TQPtrDict<TQIconViewItem> selectedItems;
struct ItemContainer {
@@ -1998,14 +1999,27 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
if ( picture() ) {
TQPicture *pic = picture();
if ( isSelected() ) {
- p->fillRect( pixmapRect( FALSE ), TQBrush( cg.highlight(), Qt::Dense4Pattern) );
+ p->setBrush( TQBrush( cg.highlight(), TQBrush::Dense4Pattern ) );
+ p->setPen( TQPen( cg.highlight(), TQBrush::Dense4Pattern ) );
+ p->drawRoundRect( pixmapRect( FALSE ),
+ 1000 / pixmapRect( FALSE ).width(),
+ 1000 / pixmapRect( FALSE ).height() );
}
p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic );
if ( isSelected() ) {
- p->fillRect( textRect( FALSE ), cg.highlight() );
+ p->setBrush( TQBrush( cg.highlight() ) );
+ p->setPen( TQPen( cg.highlight() ) );
+ p->drawRoundRect( textRect( FALSE ),
+ 1000 / textRect( FALSE ).width(),
+ 1000 / textRect( FALSE ).height() );
p->setPen( TQPen( cg.highlightedText() ) );
- } else if ( view->d->itemTextBrush != Qt::NoBrush )
- p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
+ } else if ( view->d->itemTextBrush != Qt::NoBrush ) {
+ p->setBrush( view->d->itemTextBrush );
+ p->setPen( TQPen( view->d->itemTextBrush.color() ) );
+ p->drawRoundRect( textRect( FALSE ),
+ 1000 / textRect( FALSE ).width(),
+ 1000 / textRect( FALSE ).height() );
+ }
int align = view->itemTextPos() == TQIconView::Bottom ? AlignHCenter : AlignAuto;
if ( view->d->wordWrapIconText )
@@ -2063,10 +2077,19 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
p->save();
if ( isSelected() ) {
- p->fillRect( textRect( FALSE ), cg.highlight() );
+ p->setBrush( TQBrush( cg.highlight() ) );
+ p->setPen( TQPen( cg.highlight() ) );
+ p->drawRoundRect( textRect( FALSE ),
+ 1000 / textRect( FALSE ).width(),
+ 1000 / textRect( FALSE ).height() );
p->setPen( TQPen( cg.highlightedText() ) );
- } else if ( view->d->itemTextBrush != Qt::NoBrush )
- p->fillRect( textRect( FALSE ), view->d->itemTextBrush );
+ } else if ( view->d->itemTextBrush != Qt::NoBrush ) {
+ p->setBrush( view->d->itemTextBrush );
+ p->setPen( TQPen( view->d->itemTextBrush.color() ) );
+ p->drawRoundRect( textRect( FALSE ),
+ 1000 / textRect( FALSE ).width(),
+ 1000 / textRect( FALSE ).height() );
+ }
int align = AlignHCenter;
if ( view->d->wordWrapIconText )
@@ -2082,31 +2105,14 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
/*!
Paints the focus rectangle of the item using the painter \a p and
the color group \a cg.
+
+ The default implementation does nothing; subclasses may
+ reimplement this function.
*/
-void TQIconViewItem::paintFocus( TQPainter *p, const TQColorGroup &cg )
+void TQIconViewItem::paintFocus( TQPainter *p, const TQColorGroup & )
{
- if ( !view )
- return;
- view->tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, p,
- TQRect( textRect( FALSE ).x(), textRect( FALSE ).y(),
- textRect( FALSE ).width(),
- textRect( FALSE ).height() ), cg,
- (isSelected() ?
- TQStyle::Style_FocusAtBorder :
- TQStyle::Style_Default),
- TQStyleOption(isSelected() ? cg.highlight() : cg.base()));
-
- if ( this != view->d->currentItem ) {
- view->tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, p,
- TQRect( pixmapRect( FALSE ).x(),
- pixmapRect( FALSE ).y(),
- pixmapRect( FALSE ).width(),
- pixmapRect( FALSE ).height() ),
- cg, TQStyle::Style_Default,
- TQStyleOption(cg.base()));
- }
}
/*!
@@ -2804,6 +2810,7 @@ TQIconView::TQIconView( TQWidget *tqparent, const char *name, WFlags f )
d->renamingItem = 0;
d->drawActiveSelection = TRUE;
d->drawDragShapes = FALSE;
+ d->backrubber = 0;
connect( d->adjustTimer, TQT_SIGNAL( timeout() ),
this, TQT_SLOT( adjustItems() ) );
@@ -3288,7 +3295,7 @@ uint TQIconView::count() const
void TQIconView::doAutoScroll()
{
- TQRect oldRubber = TQRect( *d->rubber );
+ TQRect oldRubber = *d->rubber;
TQPoint vp = viewport()->mapFromGlobal( TQCursor::pos() );
TQPoint pos = viewportToContents( vp );
@@ -3305,7 +3312,6 @@ void TQIconView::doAutoScroll()
bool block = tqsignalsBlocked();
TQRect rr;
- TQRegion region( 0, 0, visibleWidth(), visibleHeight() );
blockSignals( TRUE );
viewport()->setUpdatesEnabled( FALSE );
@@ -3331,9 +3337,6 @@ void TQIconView::doAutoScroll()
item->setSelected( TRUE, TRUE );
changed = TRUE;
rr = rr.unite( item->rect() );
- } else {
- region = region.subtract( TQRect( contentsToViewport( item->pos() ),
- item->size() ) );
}
minx = TQMIN( minx, item->x() - 1 );
@@ -3350,37 +3353,72 @@ void TQIconView::doAutoScroll()
viewport()->setUpdatesEnabled( TRUE );
blockSignals( block );
- TQRect r = *d->rubber;
- *d->rubber = oldRubber;
-
- TQPainter p;
- p.begin( viewport() );
- p.setRasterOp( TQt::NotROP );
- p.setPen( TQPen( Qt::color0, 1 ) );
- p.setBrush( Qt::NoBrush );
- drawRubber( &p );
- d->dragging = FALSE;
- p.end();
-
- *d->rubber = r;
-
- if ( changed ) {
- d->drawAllBack = FALSE;
- d->clipRegion = region;
- repaintContents( rr, FALSE );
- d->drawAllBack = TRUE;
+ // static bool drawAll;
+ if ( d->backrubber == 0 ) {
+ d->backrubber = new TQPixmap( viewport()->rect().size() );
+ d->backrubber->fill( viewport(), viewport()->rect().topLeft() );
+ // drawAll = true;
}
+ // int oldX = 0, oldY = 0;
+ // if ( !drawAll && d->scrollTimer ) {
+ // oldX = contentsX();
+ // oldY = contentsY();
+ // }
ensureVisible( pos.x(), pos.y() );
+ // if ( !drawAll && d->scrollTimer && ( oldX != contentsX() || oldY != contentsY() ) )
+ // drawAll = true;
- p.begin( viewport() );
- p.setRasterOp( TQt::NotROP );
- p.setPen( TQPen( Qt::color0, 1 ) );
- p.setBrush( Qt::NoBrush );
- drawRubber( &p );
- d->dragging = TRUE;
+ TQRect allRect = oldRubber.normalize();
+ if ( changed )
+ allRect |= rr.normalize();
+ allRect |= d->rubber->normalize();
+ TQPoint point = contentsToViewport( allRect.topLeft() );
+ allRect = TQRect( point.x(), point.y(), allRect.width(), allRect.height() );
+ allRect &= viewport()->rect();
+
+ d->dragging = FALSE;
+
+ TQPainter p( d->backrubber );
+ p.translate( -contentsX(), -contentsY() );
+#if 0
+ if ( !drawAll ) {
+ oldRubber = oldRubber.normalize();
+ point = contentsToViewport( oldRubber.topLeft() );
+ oldRubber = TQRect( point.x(), point.y(), oldRubber.width(), oldRubber.height() );
+ oldRubber &= viewport()->rect();
+
+ point = contentsToViewport( nr.topLeft() );
+ nr = TQRect( point.x(), point.y(), nr.width(), nr.height() );
+ nr &= viewport()->rect();
+
+ TQRegion region;
+ if ( allRect != nr )
+ region = TQRegion(allRect).subtract( TQRegion( nr ) );
+ if ( allRect != oldRubber )
+ region += TQRegion(allRect).subtract( TQRegion( oldRubber ) );
+
+ TQMemArray< TQRect > ar = region.rects();
+ for ( uint i = 0; i < ar.size(); ++i ) {
+ ar[i].addCoords( -2, -2, 4, 4 );
+ ar[i] = ar[i].normalize();
+
+ p.setClipRect( ar[i] );
+ drawContents( &p, contentsX() + ar[i].left(), contentsY() + ar[i].top(), ar[i].width(), ar[i].height() );
+ }
+ }
+ else
+#endif
+ {
+ drawContents( &p,
+ contentsX() + allRect.left(), contentsY() + allRect.top(),
+ allRect.width(), allRect.height() );
+ }
p.end();
+ // drawAll = false;
+ d->dragging = TRUE;
+ bitBlt( viewport(), allRect.topLeft(), d->backrubber, allRect );
if ( changed ) {
emit selectionChanged();
@@ -3412,9 +3450,7 @@ void TQIconView::doAutoScroll()
void TQIconView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch )
{
- if ( d->dragging && d->rubber )
- drawRubber( p );
-
+ p->save();
TQRect r = TQRect( cx, cy, cw, ch );
TQIconViewPrivate::ItemContainer *c = d->firstContainer;
@@ -3488,8 +3524,16 @@ void TQIconView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch )
d->currentItem->paintFocus( p, tqcolorGroup() );
}
- if ( d->dragging && d->rubber )
- drawRubber( p );
+ p->restore();
+ if ( d->rubber ) {
+ p->save();
+ p->translate( contentsX(), contentsY() );
+ p->setRasterOp( NotROP );
+ p->setPen( TQPen( color0, 1 ) );
+ p->setBrush( NoBrush );
+ drawRubber( p );
+ p->restore();
+ }
}
/*!
@@ -4388,17 +4432,15 @@ void TQIconView::contentsMousePressEvent( TQMouseEvent *e )
void TQIconView::contentsMousePressEventEx( TQMouseEvent *e )
{
if ( d->rubber ) {
- TQPainter p;
- p.begin( viewport() );
- p.setRasterOp( TQt::NotROP );
- p.setPen( TQPen( Qt::color0, 1 ) );
- p.setBrush( Qt::NoBrush );
+ TQRect r( d->rubber->normalize() );
+ delete d->rubber;
+ d->rubber = 0;
+
+ repaintContents( r, FALSE );
+ d->dragging = FALSE;
- drawRubber( &p );
- d->dragging = FALSE;
- p.end();
- delete d->rubber;
- d->rubber = 0;
+ delete d->backrubber;
+ d->backrubber = 0;
if ( d->scrollTimer ) {
disconnect( d->scrollTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( doAutoScroll() ) );
@@ -4583,21 +4625,17 @@ void TQIconView::contentsMouseReleaseEvent( TQMouseEvent *e )
d->startDragItem = 0;
if ( d->rubber ) {
- TQPainter p;
- p.begin( viewport() );
- p.setRasterOp( TQt::NotROP );
- p.setPen( TQPen( Qt::color0, 1 ) );
- p.setBrush( Qt::NoBrush );
-
- drawRubber( &p );
- d->dragging = FALSE;
- p.end();
+ TQRect r(d->rubber->normalize());
if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() >
TQApplication::startDragDistance() )
emitClicked = FALSE;
delete d->rubber;
d->rubber = 0;
+ repaintContents(r, FALSE);
+ d->dragging = FALSE;
+ delete d->backrubber;
+ d->backrubber = 0;
d->currentItem = d->tmpCurrentItem;
d->tmpCurrentItem = 0;
if ( d->currentItem )
@@ -5365,9 +5403,9 @@ void TQIconView::drawRubber( TQPainter *p )
TQPoint pnt( d->rubber->x(), d->rubber->y() );
pnt = contentsToViewport( pnt );
- tqstyle().tqdrawPrimitive(TQStyle::PE_RubberBand, p,
- TQRect(pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height()),
- tqcolorGroup(), TQStyle::Style_Default, TQStyleOption(tqcolorGroup().base()));
+ tqstyle().tqdrawPrimitive( TQStyle::PE_RubberBand, p,
+ TQRect( pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height() ).normalize(),
+ tqcolorGroup(), TQStyle::Style_Default, TQStyleOption(tqcolorGroup().base()) );
}
/*!