Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |

# ImageSelector Class Reference

The ImageSelector widget allows the user to select from a collection of images. More...

`#include <qtopia/imageselector.h>`

List of all member functions.

## Public Members

- ImageSelector ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
- ImageSelector ( const QStringList & source, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
- ImageSelector ( QWidget * parent, const char * name, const QString & srcdir, int wflags = 0 ) (obsolete)
- ~ImageSelector ()
- enum ViewMode { Single, Thumbnail }
- void setViewMode ( ViewMode mode )
- ViewMode viewMode () const
- void setThumbnailSize ( const int maxSide )
- int thumbnailSize () const
- void setCategory ( int id )
- int category () const
- QString selectedFilename () const
- DocLnk selectedDocument () const
- QPixmap selectedImage ( const int width, const int height ) const
- QValueList<DocLnk> fileList () const
- int fileCount () const
- ContextMenu * menu () const
- void showImageView ( bool show, bool fullscreen = false ) (obsolete)
- bool imageViewVisible () const (obsolete)

## Signals

- void selected ( const DocLnk & image )
- void held ( const DocLnk & image, const QPoint & pos )
- void fileAdded ( const DocLnk & image )
- void fileUpdated ( const DocLnk & image )
- void fileRemoved ( const DocLnk & image )
- void categoryChanged ()
- void reloaded ()

## Detailed Description

The ImageSelector widget allows the user to select from a collection of images.

ImageSelector allows the user to preview a collection of images and select individual images from the collection.

You can control how ImageSelector displays the collection by using setViewMode(). ImageSelector supports two modes of display. One mode is ImageSelector::Single. In this mode images are resized to fit within the dimensions of the ImageSelector widget. Users navigate this mode by viewing each image one after another. The other mode is ImageSelector::Thumbnail. In this mode images are resized and displayed in groups. The maximum size of the resized images can be controlled with setThumbnailSize(). Users navigate this mode by moving a highlight through the collection to the desired image.

ImageSelector emits a selected() signal when the user has made a selection. A DocLnk to the selected image is passed with the signal. In addition you can retrieve the selected image with selectedFilename() or selectedImage(). The selectedImage() function returns a QPixmap containing a scaled copy of the selected image.

First availability: Qtopia 2.0

See also ImageSelectorDialog and Qtopia Classes.

## Member Type Documentation

### ImageSelector::ViewMode

This enum describes modes of display

- `ImageSelector::Single` - The images are display one at a time.
- `ImageSelector::Thumbnail` - Groups of images are displayed as thumbnails in a scrolling viewport.

## Member Function Documentation

### ImageSelector::ImageSelector ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Construct an ImageSelector called name with parent parent and widget flags f.

Images are taken from the Documents directory.

First availability: Qtopia 2.1

### ImageSelector::ImageSelector ( const QStringList & source, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Construct an ImageSelector called name with parent parent and widget flags f.

Images are taken from the directories given in source. If source is empty images are taken from the Documents directory.

First availability: Qtopia 2.1

### ImageSelector::ImageSelector ( QWidget * parent, const char * name, const QString & srcdir, int wflags = 0 )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

### ImageSelector::~ImageSelector ()

Destroy the widget.

### int ImageSelector::category () const

Return the current category.

See Categories for more information on category IDs.

First availability: Qtopia 2.1

See also setCategory().

### void ImageSelector::categoryChanged ()`[signal]`

This signal is emitted when the category has changed.

First availability: Qtopia 2.1

### void ImageSelector::fileAdded ( const DocLnk & image )`[signal]`

This signal is emitted when an image is added to the current category. A DocLnk to the image is given in image.

First availability: Qtopia 2.1

### int ImageSelector::fileCount () const

Return the number of images in the current category.

First availability: Qtopia 2.1

### QValueList<DocLnk> ImageSelector::fileList () const

Return a list of images in the current category.

### void ImageSelector::fileRemoved ( const DocLnk & image )`[signal]`

This signal is emitted when an image is removed from the current category. A DocLnk to the image is given in image.

First availability: Qtopia 2.1

### void ImageSelector::fileUpdated ( const DocLnk & image )`[signal]`

This signal is emitted when an image is updated in the current category. A DocLnk to the image is given in image.

First availability: Qtopia 2.1

### void ImageSelector::held ( const DocLnk & image, const QPoint & pos )`[signal]`

This signal is emitted when the user has held down on an image. A DocLnk to the image is given in image. The global position of the hold is given in pos.

First availability: Qtopia 2.1

### bool ImageSelector::imageViewVisible () const

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

### ContextMenu * ImageSelector::menu () const

Return the context menu.

### void ImageSelector::reloaded ()`[signal]`

This signal is emitted when the collection has reloaded due to a disk mount or unmount.

First availability: Qtopia 2.1

See also StorageInfo::disksChanged().

### void ImageSelector::selected ( const DocLnk & image )`[signal]`

This signal is emitted when the user has selected an image from the collection. A DocLnk to the selected image is given in image.

### DocLnk ImageSelector::selectedDocument () const

Return the DocLnk of the currently selected image, or invalid DocLnk if there is no current selection.

### QString ImageSelector::selectedFilename () const

Return the file path of the currently selected image, or QString::null if there is no current selection.

### QPixmap ImageSelector::selectedImage ( const int width, const int height ) const

Return a QPixmap containing a scaled copy of the currently selected image, or null QPixmap if there is no current selection.

The image will be scaled to fit within width and height while maintaining the original width to height ratio.

### void ImageSelector::setCategory ( int id )

Set the current category to id. Only images in this category will be displayed.

See Categories for more information on category IDs.

See also category().

### void ImageSelector::setThumbnailSize ( const int maxSide )

Set the maximum side (in pixel units) of a thumbnail to maxSide. The largest thumbnail will be no greater than maxSide x maxSide pixels.

maxSide must be greater than 0.

See also thumbnailSize().

### void ImageSelector::setViewMode ( ViewMode mode )

Set the view mode to mode.

See ImageSelector::ViewMode for a listing of supported modes.

First availability: Qtopia 2.1

See also viewMode().

### void ImageSelector::showImageView ( bool show, bool fullscreen = false )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

### int ImageSelector::thumbnailSize () const

Return the current maximum side (in pixel units) of a thumbnail.

See also setThumbnailSize().

### ViewMode ImageSelector::viewMode () const

Return the current view mode.

See ImageSelector::ViewMode for a listing of supported modes.

First availability: Qtopia 2.1

See also setViewMode().

This file is part of the Qtopia platform, copyright © 1995-2004 Trolltech, all rights reserved.