You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

stevey

Trainee

  • "stevey" is male
  • "stevey" started this thread

Posts: 58

Location: Australia

Occupation: Software developer

  • Send private message

1

Thursday, July 7th 2005, 5:10am

Plugins question

Hi,

I have finally managed to compile an image format plugin for Qt 4 to open tif files.
I have the following files:
libqsytiff.a
qsytiff.dll

They installed to \plugins\imageformats so i move them to the correct \plugins\imageformats directory where Qt is actually installed.

The documentation in Qt Assisant states:
"For database drivers, image formats, text codecs, and most other plugin types, no explicit object creation is required. Qt will find and create them as required."

I had previously compiled the ImageViewer example from the Qt installation and was able to load jpg files. I believe this is done using the supplied libqjpeg.a and qjpeg.dll.
Given this, I figured that by simply selecting a tiff file, then it would just open, but I get an error stating "Cannot load <filename>"



First off, have I missed a step?
I feel there must be a call to my class but I can't find any documentation describing any more detail.

I based all my code on the source for the jpeg library and adjusted all the symbols from jpeg to SYTiff.
I have re implemented keys() with:

QStringList QSYTiffPlugin::keys() const
{
return QStringList() << "tiff" << "tif";
}


and I'm calling Q_EXPORT_PLUGIN(QSYTiffPlugin)

and my class definition is:
class QSYTiffPlugin : public QImageIOPlugin

and my .pro file has TEMPLATE = lib plugin defined.

I can post the entire source code somewhere if anyone's interested in seeing it.

Thanks,

Steve York

2

Thursday, August 4th 2005, 7:50pm

Your problem is probably in one of two places.

1. Your tiff plugin class isn't correctly reporting its capabilities.
If when implementing the QImage, you specify "tiff", your plugin should accept it. For example: QImage(filename, "tiff")

2. Your tiff ImageIOHandler class isn't identifying the file correctly
If the format "tiff" is not provided: QImage(filename), then your plugin should hand off the identification to your tiff ImageIOHandler class. It should open the device, read the image type information from the header, and return it's capability to read the file.

The imageviewer example doesn't specify "tiff", so my bet is that your problem lies in either the handoff of the capabilities determination from your plugin to your handler, or your handler isn't correctly identifying the files.

Hope this helps.
- TwoSlick

3

Wednesday, August 31st 2005, 2:07pm

Hello,

I'm interested in your plugin code :)
Thanks ;)

Guilugi