Information on the Qt plugin API

The sample code and image plugin interface are not supported by Perforce Software and no warranty or guarentee is provided by Perforce Software for their use.

Qt provides a fairly straight forward interface for building your own image plugins. Trolltech has documentation for all of the necessary APIs on their site. Here is a list of some of the more pertinent links:

A general overview of the plugin interface.

Specifics on the image format plugin interface.

Information on the defineIOHandler method. This method has to be provided in your image plugin.

Information on the QImage interface. QImage is very handy for manipulating and storing image data.

Sample source code is available in the Perforce Public Depot here. The sample source code has been tested with Qt 3.3.4 and Visual Studio 7.1. A solution file is provided with appropriate build settings. Please note that image plugins only work with the Windows version of P4V and p4thumb due to the fact that the Unix and Mac versions of P4V are compilied statically with the Qt libraries. To build a plugin that works with the r05.1 P4V/p4thumb use the 3.3.4 Qt libraries configured to build dynamically.

To use a compiled dll with P4V or p4thumb create a folder in the same directory as the executable you wish to use the plugin with called "imageformats". Put the dll in the new folder and restart the application.

When building your own image plugins for use with P4V and p4thumb, it is only necessary to provide a method to read the file format. P4V and p4thumb do not need to be able to write the image to disk using the orginal format.