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

# ImageSelectorDialog Class Reference

The ImageSelectorDialog widget presents the ImageSelector widget as a dialog. It allows the user to select from a collection of images. More...

`#include <qtopia/imageselector.h>`

List of all member functions.

## Public Members

- ImageSelectorDialog ( QWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = 0 )
- ImageSelectorDialog ( const QStringList & source, QWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = 0 )
- ImageSelectorDialog ( QWidget * parent, const char * name, bool modal, const QString & srcdir, int wflags = 0 ) (obsolete)
- ~ImageSelectorDialog ()
- QString selectedFilename () const
- DocLnk selectedDocument () const
- QPixmap selectedImage ( const int width, const int height ) const
- QValueList<DocLnk> fileList () const
- void setThumbnailSize ( const int maxSide )
- int thumbnailSize () const
- ContextMenu * menu () const

## Signals

- void selected ( const DocLnk & image ) (obsolete)

## Detailed Description

The ImageSelectorDialog widget presents the ImageSelector widget as a dialog. It allows the user to select from a collection of images.

This code snippet allows the user to select a wallpaper from the Qtopia directories:

        QStringList locations;
        QStringList qtopiaPaths = Global::qtopiaPaths();
        for( QStringList::Iterator it = qtopiaPaths.begin(); it != qtopiaPaths.end(); ++it )
            locations.append( *it + "pics/wallpaper" );

        ImageSelectorDialog dialog( locations, this );
        if( QPEApplication::execDialog( &dialog ) ) {
            // Accept
        } else {
            // Reject
        }

You can retrieve the selected image with selectedDocument(), selectedFilename() and selectedImage(). The selectedImage() function returns a QPixmap containing a scaled copy of the selected image.

First availability: Qtopia 2.0

See also ImageSelector and Qtopia Classes.

## Member Function Documentation

### ImageSelectorDialog::ImageSelectorDialog ( QWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = 0 )

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

The dialog is modal if modal is TRUE (default), otherwise the dialog is modeless.

Images are taken from the Documents directory.

First availability: Qtopia 2.1

### ImageSelectorDialog::ImageSelectorDialog ( const QStringList & source, QWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = 0 )

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

The dialog is modal if modal is TRUE (default), otherwise the dialog is modeless.

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

### ImageSelectorDialog::ImageSelectorDialog ( QWidget * parent, const char * name, bool modal, 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.

### ImageSelectorDialog::~ImageSelectorDialog ()

Destroy the widget.

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

Return a list of images in the current category.

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

Return the context menu.

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

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

### DocLnk ImageSelectorDialog::selectedDocument () const

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

### QString ImageSelectorDialog::selectedFilename () const

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

### QPixmap ImageSelectorDialog::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 ImageSelectorDialog::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().

### int ImageSelectorDialog::thumbnailSize () const

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

See also setThumbnailSize().

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