summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qppmhandler.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 13:06:19 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 14:33:51 +0200
commitdf55141aa260c8a10c06aa990b6f20d6fb4718f3 (patch)
tree90b6e5c168b83232187ce61cc4e5ffbf530d6118 /src/gui/image/qppmhandler.cpp
parentc28efecdcfdd5fa0049bf482cb102814338c0d99 (diff)
Fixed QImageReader::format() inconsistency.
If state is set to ReadHeader before canRead() then setFormat("png") never gets called. We should make sure that setFormat() gets set whenever canRead() returns true. Task-number: QTBUG-2263 Reviewed-by: Kent Hansen
Diffstat (limited to 'src/gui/image/qppmhandler.cpp')
-rw-r--r--src/gui/image/qppmhandler.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index cbbbef4b20..a9e796c268 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -409,13 +409,15 @@ bool QPpmHandler::readHeader()
bool QPpmHandler::canRead() const
{
- if (state == Ready) {
- if (!canRead(device(), &subType))
- return false;
+ if (state == Ready && !canRead(device(), &subType))
+ return false;
+
+ if (state != Error) {
setFormat(subType);
return true;
}
- return state != Error;
+
+ return false;
}
bool QPpmHandler::canRead(QIODevice *device, QByteArray *subType)