summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/ico
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/imageformats/ico')
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 6d2c06c9c8..b9b51130b5 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -779,11 +779,29 @@ QtIcoHandler::~QtIcoHandler()
QVariant QtIcoHandler::option(ImageOption option) const
{
- if (option == Size) {
+ if (option == Size || option == ImageFormat) {
ICONDIRENTRY iconEntry;
if (m_pICOReader->readIconEntry(m_currentIconIndex, &iconEntry)) {
- return QSize(iconEntry.bWidth ? iconEntry.bWidth : 256,
- iconEntry.bHeight ? iconEntry.bHeight : 256);
+ switch (option) {
+ case Size:
+ return QSize(iconEntry.bWidth ? iconEntry.bWidth : 256,
+ iconEntry.bHeight ? iconEntry.bHeight : 256);
+
+ case ImageFormat:
+ switch (iconEntry.wBitCount) {
+ case 2:
+ return QImage::Format_Mono;
+ case 24:
+ return QImage::Format_RGB32;
+ case 32:
+ return QImage::Format_ARGB32;
+ default:
+ return QImage::Format_Indexed8;
+ }
+ break;
+ default:
+ break;
+ }
}
}
return QVariant();
@@ -791,7 +809,7 @@ QVariant QtIcoHandler::option(ImageOption option) const
bool QtIcoHandler::supportsOption(ImageOption option) const
{
- return option == Size;
+ return (option == Size || option == ImageFormat);
}
/*!