diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-08-05 00:23:35 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-08-05 00:23:35 -0500 |
commit | 3653f049bf83636d00237e61781e68ae7c3b499a (patch) | |
tree | d8e67edf68c35bbbb8d47fe720ec5a8af7ee3b17 /main/dependencies | |
parent | 4dd6a7ae2cf8d7fc3df7c9743129cec736c0d591 (diff) | |
download | tde-3653f049bf83636d00237e61781e68ae7c3b499a.tar.gz tde-3653f049bf83636d00237e61781e68ae7c3b499a.zip |
[ENHANCEMENT] Add skeleton of setVisible()/isVisible() support to QIconView
Diffstat (limited to 'main/dependencies')
-rw-r--r-- | main/dependencies/qt3/src/iconview/qiconview.cpp | 133 | ||||
-rw-r--r-- | main/dependencies/qt3/src/iconview/qiconview.h | 4 |
2 files changed, 90 insertions, 47 deletions
diff --git a/main/dependencies/qt3/src/iconview/qiconview.cpp b/main/dependencies/qt3/src/iconview/qiconview.cpp index 04585b779..c1ea8cc28 100644 --- a/main/dependencies/qt3/src/iconview/qiconview.cpp +++ b/main/dependencies/qt3/src/iconview/qiconview.cpp @@ -995,6 +995,7 @@ void QIconViewItem::init( QIconViewItem *after allow_rename = FALSE; allow_drag = TRUE; allow_drop = TRUE; + visible = TRUE; selected = FALSE; selectable = TRUE; #ifndef QT_NO_TEXTEDIT @@ -1050,6 +1051,32 @@ int QIconViewItem::rtti() const return RTTI; } +/*! + If \a b is TRUE, the item is made visible; otherwise it is hidden. +*/ + +void QIconViewItem::setVisible( bool b ) +{ + if ( b == (bool)visible ) + return; + QIconView *iv = iconView(); + if ( !iv ) + return; + visible = b; + if ( iv ) + iv->updateContents(); +} + +/*! + Returns TRUE if the item is visible; otherwise returns FALSE. + + \sa setVisible() +*/ + +bool QIconViewItem::isVisible() const +{ + return (bool)visible; +} /*! Sets \a text as the text of the icon view item. This function @@ -3851,10 +3878,18 @@ void QIconView::selectAll( bool select ) viewport()->setUpdatesEnabled( FALSE ); QRect rr; for ( ; item; item = item->next ) { - if ( select != item->isSelected() ) { - item->setSelected( select, TRUE ); - rr = rr.unite( item->rect() ); - changed = TRUE; + if (item->isVisible()) { + if ( select != item->isSelected() ) { + item->setSelected( select, TRUE ); + rr = rr.unite( item->rect() ); + changed = TRUE; + } + else { + if ( FALSE != item->isSelected() ) { + item->setSelected( FALSE, TRUE ); + changed = TRUE; + } + } } } viewport()->setUpdatesEnabled( ue ); @@ -4082,7 +4117,7 @@ void QIconView::clear() d->drawDragShapes = FALSE; resizeContents( 0, 0 ); - // maybe we don´t need this update, so delay it + // maybe we don�t need this update, so delay it d->fullRedrawTimer->start( 0, TRUE ); d->cleared = TRUE; @@ -6139,17 +6174,19 @@ void QIconView::updateItemContainer( QIconViewItem *item ) return; } - c->items.append( item ); - item->d->container1 = c; + if (item->isVisible()) { + c->items.append( item ); + item->d->container1 = c; - if ( !contains ) { - c = c->n; - if ( !c ) { - appendItemContainer(); - c = d->lastContainer; - } - c->items.append( item ); - item->d->container2 = c; + if ( !contains ) { + c = c->n; + if ( !c ) { + appendItemContainer(); + c = d->lastContainer; + } + c->items.append( item ); + item->d->container2 = c; + } } if ( contentsWidth() < irect.right() || contentsHeight() < irect.bottom() ) resizeContents( QMAX( contentsWidth(), irect.right() ), QMAX( contentsHeight(), irect.bottom() ) ); @@ -6204,40 +6241,42 @@ void QIconView::rebuildContainers() appendItemContainer(); c = d->lastContainer; while ( item ) { - if ( c->rect.contains( item->rect() ) ) { - item->d->container1 = c; - item->d->container2 = 0; - c->items.append( item ); - item = item->next; - } else if ( c->rect.intersects( item->rect() ) ) { - item->d->container1 = c; - c->items.append( item ); - c = c->n; - if ( !c ) { - appendItemContainer(); - c = d->lastContainer; - } - c->items.append( item ); - item->d->container2 = c; - item = item->next; - c = c->p; - } else { - if ( d->arrangement == LeftToRight ) { - if ( item->y() < c->rect.y() && c->p ) { - c = c->p; - continue; - } + if (item->isVisible()) { + if ( c->rect.contains( item->rect() ) ) { + item->d->container1 = c; + item->d->container2 = 0; + c->items.append( item ); + item = item->next; + } else if ( c->rect.intersects( item->rect() ) ) { + item->d->container1 = c; + c->items.append( item ); + c = c->n; + if ( !c ) { + appendItemContainer(); + c = d->lastContainer; + } + c->items.append( item ); + item->d->container2 = c; + item = item->next; + c = c->p; } else { - if ( item->x() < c->rect.x() && c->p ) { - c = c->p; - continue; - } - } + if ( d->arrangement == LeftToRight ) { + if ( item->y() < c->rect.y() && c->p ) { + c = c->p; + continue; + } + } else { + if ( item->x() < c->rect.x() && c->p ) { + c = c->p; + continue; + } + } - c = c->n; - if ( !c ) { - appendItemContainer(); - c = d->lastContainer; + c = c->n; + if ( !c ) { + appendItemContainer(); + c = d->lastContainer; + } } } } diff --git a/main/dependencies/qt3/src/iconview/qiconview.h b/main/dependencies/qt3/src/iconview/qiconview.h index 2da3ed0e8..97780d844 100644 --- a/main/dependencies/qt3/src/iconview/qiconview.h +++ b/main/dependencies/qt3/src/iconview/qiconview.h @@ -169,6 +169,9 @@ public: bool isSelected() const; bool isSelectable() const; + void setVisible( bool b ); + bool isVisible() const; + virtual void repaint(); virtual bool move( int x, int y ); @@ -249,6 +252,7 @@ private: uint allow_rename : 1; uint allow_drag : 1; uint allow_drop : 1; + uint visible : 1; uint selected : 1; uint selectable : 1; uint dirty : 1; |