Q3FileIconProvider Class Reference

#include <q3filedialog.h>

Inheritance diagram for Q3FileIconProvider:

Inheritance graph
[legend]
Collaboration diagram for Q3FileIconProvider:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Q3FileIconProvider class provides icons for Q3FileDialog to use.

By default Q3FileIconProvider is not used, but any application or library can subclass it, reimplement pixmap() to return a suitable icon, and make all Q3FileDialog objects use it by calling the static function Q3FileDialog::setIconProvider().

It is advisable to make all the icons that Q3FileIconProvider returns be the same size or at least the same width. This makes the list view look much better.

See also:
Q3FileDialog

Definition at line 52 of file q3filedialog.h.

Public Member Functions

 Q3FileIconProvider (QObject *parent=0, const char *name=0)
virtual const QPixmappixmap (const QFileInfo &)


Constructor & Destructor Documentation

Q3FileIconProvider::Q3FileIconProvider ( QObject parent = 0,
const char *  name = 0 
)

Constructs an empty file icon provider called name, with the parent parent.

Definition at line 4870 of file q3filedialog.cpp.

04871     : QObject(parent, name)
04872 {
04873     // nothing necessary
04874 }


Member Function Documentation

const QPixmap * Q3FileIconProvider::pixmap ( const QFileInfo info  )  [virtual]

Returns a pointer to a pixmap that should be used to signify the file with the information info.

If pixmap() returns 0, Q3FileDialog draws the default pixmap.

The default implementation returns particular icons for files, directories, link-files and link-directories. It returns a blank "icon" for other types.

If you return a pixmap here, it should measure 16x16 pixels.

Definition at line 4889 of file q3filedialog.cpp.

References closedFolderIcon, fifteenTransparentPixels, fileIcon, info, symLinkDirIcon, and symLinkFileIcon.

Referenced by Q3FileDialog::doMimeTypeLookup().

04890 {
04891     if (info.isSymLink()) {
04892         if (info.isFile())
04893             return symLinkFileIcon;
04894         else
04895             return symLinkDirIcon;
04896     } else if (info.isDir()) {
04897         return closedFolderIcon;
04898     } else if (info.isFile()) {
04899         return fileIcon;
04900     } else {
04901         return fifteenTransparentPixels;
04902     }
04903 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 15:56:26 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1