Custom image plugin testing difficulties
-
Sorry about the code part, I had a problem when I read it first and only saw the end of it.
What about a more simple json ?{ "Keys": [ "tim" ], "MimeTypes": [ "image/x-tim" ] }
-
Well, while I could try that, I don't know if that's the mime type for TIM files. A Google search doesn't help either. My examination of qtraw shows that it too lacks a mime type entry. Thus, I thought it was unnecessary.
EDIT: tried it anyway, still nothing
-
Just thought of something… Your plugin code is correct but:
img.load("0025.tim", "tim");
"0025.tim" is a relative path, is that image in the same folder as your executable ? You should rather give the full path to it.
-
Same directory, yep. Though of course in a real world scenario this would be different.
-
I forgot a correction I made:
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tim.json")
-
Yeah, I changed it to that in my progress trying to fix it, but no go. I booted up QtCreator and created a new project from Qt plugin template but I see nothing unusual in comparison with my code, aside from the constructor with QObject* parameter, which I skipped in my code because I saw no point for an empty constructor/destructor.
-
So after a little tinkering, I got qmake to generate main.moc which I thought was needed, but I'm still having issues with the plugin not being discovered. Additionally, the RGBA5551 conversion function was incorrect, which I fixed, but that shouldn't be the make-or-break factor.
-
Not being discovered or not loaded ? Did you put your plugin in a imageformats subfolder ?
-
Yep. Even set target.path in my .pro file thinking that was the issue. Qt seems very nitpicky.
EDIT: Just debugged again, found this gem of an error:
QLibraryPrivate::loadPlugin failed on "/home/admin/Documents/Qt-extra/imageformats/qtim/timtest/imageformats/libqtim.so" : "Cannot load library /home/admin/Documents/Qt-extra/imageformats/qtim/timtest/imageformats/libqtim.so: (/home/admin/Documents/Qt-extra/imageformats/qtim/timtest/imageformats/libqtim.so: undefined symbol: _ZN11QTimHandler9setOptionEN15QImageIOHandler11ImageOptionERK8QVariant)"
-
Which version of Qt are you using ?
What happens if you try to load it by hand using QLibrary ?