[Qt-interest] SOLVED QImageReader cannot detect image format
Guido Seifert
Wargand at gmx.de
Thu May 6 18:52:05 CEST 2010
> That would be odd, since the only thing
> QImageReader::imageFormat(const
> QString &fileName) does with the filename you pass to it is to
> create a QFile with it (in Qt 4.6.2 at least). Since QFile takes
> absolute filepaths, so does QImageReader::imageFormat.
Yeah, really odd. Especially since the Trolls are quite good when it comes to reusing things like that.
> Why don't you show us the line of code that isn't working, and
> the types and values of any variables used on that line?
Can't. I am at home now. And naturally on my personal machines it works. I should stop reporting things I experience on my work computer. Too many strange things happen there.
> Are you sure you have permission to read the file? Does directly
> passing that same file name to QFile fail too?
Quite sure. It did not work till I did this:
QString currPath = QDir::currentPath();
QDir::setCurrent (FileHandling::temporaryDir());
QString imageFormat = QImageReader::imageFormat (filename);
QDir::setCurrent(currPath);
Before that I just did:
QString path = FileHandling::temporaryDir()+filename;
QString imageFormat = QImageReader::imageFormat(path);
And yes, I checked path. It was fine. No forgotten '/'.
And no, I tested with QFile and QImage. It worked. Permissions were fine, too. Else I would not have called it 'sick'. ;-)
Nevertheless, I have a workaround. Till Monday no access to my work computer and even then no time to figure out, what or great admins did to our system.
Guido
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the Qt-interest-old
mailing list