summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-08-05 00:23:35 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-08-05 00:23:35 -0500
commitd82327fe4f56dcffc27a6af162cbed23adf83d8d (patch)
tree77fc86a1e261e29978e2d52a52d7993b057bce95 /src
parentba6061655cf92ec73f591b3735c2853a684ecaf2 (diff)
downloadqt3-d82327fe4f56dcffc27a6af162cbed23adf83d8d.tar.gz
qt3-d82327fe4f56dcffc27a6af162cbed23adf83d8d.zip
[ENHANCEMENT] Add skeleton of setVisible()/isVisible() support to QIconView
Diffstat (limited to 'src')
-rw-r--r--src/iconview/qiconview.cpp133
-rw-r--r--src/iconview/qiconview.h4
2 files changed, 90 insertions, 47 deletions
diff --git a/src/iconview/qiconview.cpp b/src/iconview/qiconview.cpp
index 04585b7..c1ea8cc 100644
--- a/src/iconview/qiconview.cpp
+++ b/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/src/iconview/qiconview.h b/src/iconview/qiconview.h
index 2da3ed0..97780d8 100644
--- a/src/iconview/qiconview.h
+++ b/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;