diff --git a/src/iconview/qiconview.cpp b/src/iconview/qiconview.cpp index fbcf3316..d6b856ae 100644 --- a/src/iconview/qiconview.cpp +++ b/src/iconview/qiconview.cpp @@ -1137,6 +1137,9 @@ void TQIconViewItem::setKey( const TQString &k ) void TQIconViewItem::setPixmap( const TQPixmap &icon ) { + if (isVisible() == FALSE) + return; + if ( itemIcon && itemIcon == unknown_icon ) itemIcon = 0; @@ -1235,6 +1238,9 @@ void TQIconViewItem::setText( const TQString &text, bool recalc, bool redraw ) void TQIconViewItem::setPixmap( const TQPixmap &icon, bool recalc, bool redraw ) { + if (isVisible() == FALSE) + return; + if ( itemIcon && itemIcon == unknown_icon ) itemIcon = 0; @@ -3008,7 +3014,7 @@ void TQIconView::insertItem( TQIconViewItem *item, TQIconViewItem *after ) //insertInGrid( item ); d->cachedW = TQMAX( d->cachedW, item->x() + item->width() ); - d->cachedH= TQMAX( d->cachedH, item->y() + item->height() ); + d->cachedH = TQMAX( d->cachedH, item->y() + item->height() ); d->updateTimer->start( 0, TRUE ); } else { @@ -3587,6 +3593,9 @@ void TQIconView::arrangeItemsInGrid( bool update ) int w = 0, h = 0, y = d->spacing; TQIconViewItem *item = d->firstItem; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } bool changedLayout = FALSE; while ( item ) { bool changed; @@ -3604,21 +3613,37 @@ void TQIconView::arrangeItemsInGrid( bool update ) break; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } } if ( d->lastItem && d->arrangement == TopToBottom ) { item = d->lastItem; - int x = item->x(); + while (item && (item->isVisible() == FALSE)) { + item = item->prev; + } + int x = 0; + if (item) + x = item->x(); while ( item && item->x() >= x ) { w = TQMAX( w, item->x() + item->width() ); h = TQMAX( h, item->y() + item->height() ); item = item->prev; + while (item && (item->isVisible() == FALSE)) { + item = item->prev; + } } } d->containerUpdateLocked = FALSE; - w = TQMAX( TQMAX( d->cachedW, w ), d->lastItem->x() + d->lastItem->width() ); - h = TQMAX( TQMAX( d->cachedH, h ), d->lastItem->y() + d->lastItem->height() ); + TQIconViewItem *lastVisibleItem = d->lastItem; + while (lastVisibleItem->prev && (lastVisibleItem->isVisible() == FALSE)) { + lastVisibleItem = lastVisibleItem->prev; + } + + w = TQMAX( TQMAX( d->cachedW, w ), lastVisibleItem->x() + lastVisibleItem->width() ); + h = TQMAX( TQMAX( d->cachedH, h ), lastVisibleItem->y() + lastVisibleItem->height() ); if ( d->arrangement == TopToBottom ) w += d->spacing; @@ -3977,8 +4002,8 @@ void TQIconView::ensureItemVisible( TQIconViewItem *item ) if ( !item ) return; - if ( d->updateTimer && d->updateTimer->isActive() || - d->fullRedrawTimer && d->fullRedrawTimer->isActive() ) + if ( (d->updateTimer && d->updateTimer->isActive()) || + (d->fullRedrawTimer && d->fullRedrawTimer->isActive()) ) slotUpdate(); int w = item->width(); @@ -5793,6 +5818,15 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & { TQIconViewItem *end = 0; + // Find the first visible item + while (begin->next && (begin->isVisible() == FALSE)) { + begin = begin->next; + } + if (!begin->next) { + changed = TRUE; + return begin; + } + bool reverse = TQApplication::reverseLayout(); changed = FALSE; @@ -5808,12 +5842,18 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & x += d->spacing + item->width(); if ( x > visibleWidth() && item != begin ) { item = item->prev; + while (item && (item->isVisible() == FALSE)) { + item = item->prev; + } break; } h = TQMAX( h, item->height() ); ih = TQMAX( ih, item->pixmapRect().height() ); TQIconViewItem *old = item; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } if ( !item ) { item = old; break; @@ -5869,12 +5909,18 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & } if ( x > visibleWidth() && item != begin ) { item = item->prev; + while (item && (item->isVisible() == FALSE)) { + item = item->prev; + } break; } h = TQMAX( h, item->height() ); ih = TQMAX( ih, item->pixmapRect().height() ); TQIconViewItem *old = item; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } if ( !item ) { item = old; break; @@ -5915,6 +5961,9 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & if ( item == end ) break; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } } y += h + d->spacing; } @@ -5932,11 +5981,17 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & y += d->spacing + item->height(); if ( y > visibleHeight() && item != begin ) { item = item->prev; + while (item && (item->isVisible() == FALSE)) { + item = item->prev; + } break; } w = TQMAX( w, item->width() ); TQIconViewItem *old = item; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } if ( !item ) { item = old; break; @@ -5966,6 +6021,9 @@ TQIconViewItem *TQIconView::makeRowLayout( TQIconViewItem *begin, int &y, bool & if ( item == end ) break; item = item->next; + while (item && (item->isVisible() == FALSE)) { + item = item->next; + } } x += w + d->spacing; } @@ -6279,6 +6337,10 @@ void TQIconView::rebuildContainers() } } } + else { + // Skip this hidden item + item = item->next; + } } }