# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KFileIconView Class Reference

An icon-view capable of showing KFileItem's. More...

`#include <kfileiconview.h>`

Inheritance diagram for KFileIconView:

[legend]
Collaboration diagram for KFileIconView:

[legend]
List of all members.

## Public Slots

void | showPreviews ()
| Starts loading previews for all files shown and shows them.
virtual void | arrangeItemsInGrid (bool updated=true)
| Reimplemented for performance reasons.

## Public Member Functions

| KFileIconView (QWidget *parent, const char *name)
virtual QWidget * | widget ()
| a pure virtual function to get a QWidget, that can be added to other widgets.
virtual void | clearView ()
| pure virtual function, that should be implemented to clear the view.
virtual void | setAutoUpdate (bool)
virtual void | updateView (bool)
| does a repaint of the view.
virtual void | updateView (const KFileItem *)
virtual void | removeItem (const KFileItem *)
| Removes an item from the list; has to be implemented by the view.
virtual void | listingCompleted ()
| This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e.
virtual void | insertItem (KFileItem *i)
| The derived view must implement this function to add the file in the widget.
virtual void | setSelectionMode (KFile::SelectionMode sm)
virtual void | setSelected (const KFileItem *, bool)
| Tells the view that it should highlight the item.
virtual bool | isSelected (const KFileItem *i) const
virtual void | clearSelection ()
| Clears any selection, unhighlights everything.
virtual void | selectAll ()
| Selects all items.
virtual void | invertSelection ()
| Inverts the current selection, i.e.
virtual void | setCurrentItem (const KFileItem *)
| Reimplement this to set `item` the current item in the view, e.g.
virtual KFileItem * | currentFileItem () const
virtual KFileItem * | firstFileItem () const
virtual KFileItem * | nextItem (const KFileItem *) const
virtual KFileItem * | prevItem (const KFileItem *) const
void | setIconSize (int size)
| Sets the size of the icons to show.
void | setPreviewSize (int size)
| Sets the size of the previews.
int | iconSize () const
void | ensureItemVisible (const KFileItem *)
| pure virtual function, that should be implemented to make item i visible, i.e.
virtual void | setSorting (QDir::SortSpec sort)
| Sets the sorting order of the view.
virtual void | readConfig (KConfig *, const QString &group=QString::null)
virtual void | writeConfig (KConfig *, const QString &group=QString::null)
void | mimeTypeDeterminationFinished ()
void | determineIcon (KFileIconViewItem *item)
QScrollView * | scrollWidget () const

## Protected Member Functions

virtual void | keyPressEvent (QKeyEvent *)
| Reimplemented to not let QIconView eat return-key events.
virtual void | hideEvent (QHideEvent *)
| Reimplemented to remove an eventual tooltip.
virtual void | showEvent (QShowEvent *)
virtual bool | eventFilter (QObject *o, QEvent *e)
virtual void | virtual_hook (int id, void *data)

## Detailed Description

An icon-view capable of showing KFileItem's.

Used in the filedialog for example. Most of the documentation is in KFileView class.

See also:
  KDirOperator

  KCombiView

  KFileDetailView

Definition at line 82 of file kfileiconview.h.

## Member Function Documentation

virtual QWidget* KFileIconView::widget | ( |  | ) | `[inline, virtual]`

| a pure virtual function to get a QWidget, that can be added to other widgets. This function is needed to make it possible for derived classes to derive from other widgets. Implements KFileView. Definition at line 90 of file kfileiconview.h.

void KFileIconView::clearView | ( |  | ) | `[virtual]`

| pure virtual function, that should be implemented to clear the view. At this moment the list is already empty Implements KFileView. Definition at line 292 of file kfileiconview.cpp. References QIconView::clear(), QPtrList< KFileIconViewItem >::clear(), and KMimeTypeResolver< KFileIconViewItem, KFileIconView >::m_lstPendingMimeIconItems. Referenced by KCombiView::clearView().

void KFileIconView::updateView | ( | bool |  | ) | `[virtual]`

does a repaint of the view.

The default implementation calls

    widget()->repaint(f)

Reimplemented from KFileView.

Definition at line 397 of file kfileiconview.cpp.

References KFileIconViewItem::fileInfo(), QIconView::firstItem(), QIconViewItem::nextItem(), and QIconViewItem::setPixmap().

Referenced by KCombiView::updateView().

void KFileIconView::removeItem | ( | const KFileItem * |  | ) | `[virtual]`

Removes an item from the list; has to be implemented by the view.

Call KFileView::removeItem( item ) after removing it.

Reimplemented from KFileView.

Definition at line 429 of file kfileiconview.cpp.

References KMimeTypeResolver< KFileIconViewItem, KFileIconView >::m_lstPendingMimeIconItems, QPtrList< KFileIconViewItem >::remove(), and KFileView::removeItem().

Referenced by KCombiView::removeItem().

void KFileIconView::listingCompleted | ( |  | ) | `[virtual]`

This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e.

there won't come any new items anymore.

Reimplemented from KFileView.

Definition at line 659 of file kfileiconview.cpp.

References arrangeItemsInGrid(), QIconView::currentItem(), QIconView::setCurrentItem(), QIconView::setSelected(), and KMimeTypeResolver< KFileIconViewItem, KFileIconView >::start().

Referenced by KCombiView::listingCompleted().

void KFileIconView::insertItem | ( | KFileItem * | i | ) | `[virtual]`

The derived view must implement this function to add the file in the widget.

Make sure to call this implementation, i.e. KFileView::insertItem( i );

Reimplemented from KFileView.

Definition at line 300 of file kfileiconview.cpp.

References QPtrList< KFileIconViewItem >::append(), KFileView::insertItem(), KFileItem::isMimeTypeKnown(), KMimeTypeResolver< KFileIconViewItem, KFileIconView >::m_lstPendingMimeIconItems, KFileItem::pixmap(), KFileItem::setExtraData(), and KFileItem::text().

Referenced by KCombiView::insertItem().

void KFileIconView::setSelected | ( | const KFileItem * | ,
|  | bool |
| ) | `[virtual]`

| Tells the view that it should highlight the item. This function must be implemented by the view. Implements KFileView. Definition at line 266 of file kfileiconview.cpp. References QIconView::setSelected(). Referenced by KCombiView::setSelected().

bool KFileIconView::isSelected | ( | const KFileItem * | i | ) | const`[virtual]`

Returns:
  whether the given item is currently selected. Must be implemented by the view.

Implements KFileView.

Definition at line 391 of file kfileiconview.cpp.

References QIconViewItem::isSelected().

Referenced by KCombiView::isSelected().

void KFileIconView::clearSelection | ( |  | ) | `[virtual]`

| Clears any selection, unhighlights everything. Must be implemented by the view. Implements KFileView. Definition at line 282 of file kfileiconview.cpp. References QIconView::clearSelection(). Referenced by KCombiView::clearSelection().

void KFileIconView::selectAll | ( |  | ) | `[virtual]`

| Selects all items. You may want to override this, if you can implement it more efficiently than calling setSelected() with every item. This works only in Multiselection mode of course. Reimplemented from KFileView. Definition at line 273 of file kfileiconview.cpp. References QIconView::selectAll(). Referenced by KCombiView::selectAll().

void KFileIconView::invertSelection | ( |  | ) | `[virtual]`

| Inverts the current selection, i.e. selects all items, that were up to now not selected and deselects the other. Reimplemented from KFileView. Definition at line 287 of file kfileiconview.cpp. References QIconView::invertSelection(). Referenced by KCombiView::invertSelection().

void KFileIconView::setCurrentItem | ( | const KFileItem * |  | ) | `[virtual]`

| Reimplement this to set `item` the current item in the view, e.g. the item having focus. Implements KFileView. Definition at line 336 of file kfileiconview.cpp. References QIconView::setCurrentItem(). Referenced by KCombiView::setCurrentItem().

KFileItem * KFileIconView::currentFileItem | ( |  | ) | const`[virtual]`

Returns:
  the "current" KFileItem, e.g. where the cursor is. Returns 0L when there is no current item (e.g. in an empty view). Subclasses have to implement this.

Implements KFileView.

Definition at line 343 of file kfileiconview.cpp.

References QIconView::currentItem(), and KFileIconViewItem::fileInfo().

Referenced by KCombiView::currentFileItem().

void KFileIconView::setIconSize | ( | int | size | ) |

| Sets the size of the icons to show. Defaults to KIcon::SizeSmall. Definition at line 441 of file kfileiconview.cpp.

void KFileIconView::setPreviewSize | ( | int | size | ) |

| Sets the size of the previews. Defaults to KIcon::SizeLarge. Definition at line 447 of file kfileiconview.cpp.

int KFileIconView::iconSize | ( |  | ) | const`[inline]`

Returns:
  the current size used for icons.

Definition at line 128 of file kfileiconview.h.

void KFileIconView::ensureItemVisible | ( | const KFileItem * |  | ) | `[virtual]`

| pure virtual function, that should be implemented to make item i visible, i.e. by scrolling the view appropriately. Implements KFileView. Definition at line 460 of file kfileiconview.cpp. References QIconView::ensureItemVisible(). Referenced by KCombiView::ensureItemVisible().

void KFileIconView::setSorting | ( | QDir::SortSpec | sort | ) | `[virtual]`

Sets the sorting order of the view.

Default is QDir::Name | QDir::IgnoreCase | QDir::DirsFirst Override this in your subclass and sort accordingly (usually by setting the sorting-key for every item and telling QIconView or QListView to sort.

A view may choose to use a different sorting than QDir::Name, Time or Size. E.g. to sort by mimetype or any possible string. Set the sorting to QDir::Unsorted for that and do the rest internally.

See also:
  sortingKey

Reimplemented from KFileView.

Definition at line 618 of file kfileiconview.cpp.

References QPtrListIterator::current(), KFileItem::isDir(), KFileView::isReversed(), KFileView::items(), QIconViewItem::setKey(), QIconView::setSorting(), KFileView::setSorting(), KFileItem::size(), QIconView::sort(), KFileView::sortingKey(), KFileItem::text(), and KFileItem::time().

Referenced by KCombiView::setSorting().

void KFileIconView::showPreviews | ( |  | ) | `[slot]`

| Starts loading previews for all files shown and shows them. Switches into 'large rows' mode, if that isn't the current mode yet. Definition at line 529 of file kfileiconview.cpp. References KIO::filePreview(), KFileView::items(), and KIO::PreviewJob::supportedMimeTypes().

void KFileIconView::arrangeItemsInGrid | ( | bool | updated = true | ) | `[virtual, slot]`

Reimplemented for performance reasons.

Since:
  3.1

Reimplemented from QIconView.

Definition at line 731 of file kfileiconview.cpp.

References QIconView::arrangeItemsInGrid().

Referenced by listingCompleted().

void KFileIconView::keyPressEvent | ( | QKeyEvent * |  | ) | `[protected, virtual]`

| Reimplemented to not let QIconView eat return-key events. Definition at line 256 of file kfileiconview.cpp. References QKeyEvent::ignore(), QKeyEvent::key(), and QKeyEvent::state().

void KFileIconView::hideEvent | ( | QHideEvent * |  | ) | `[protected, virtual]`

| Reimplemented to remove an eventual tooltip. Definition at line 250 of file kfileiconview.cpp.

The documentation for this class was generated from the following files:

- kfileiconview.h
- kfileiconview.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:17:10 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001