src/gui/image/qpixmap.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 30 5dc02b23752f
--- a/src/gui/image/qpixmap.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/gui/image/qpixmap.cpp	Mon May 03 13:17:34 2010 +0300
@@ -831,21 +831,14 @@
     if (QPixmapCache::find(key, *this))
         return true;
 
-    bool ok;
-
-    if (data) {
-        ok = data->fromFile(fileName, format, flags);
-    } else {
-        QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType));
-        ok = tmp->fromFile(fileName, format, flags);
-        if (ok)
-            data = tmp.take();
+    QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType));
+    if (tmp->fromFile(fileName, format, flags)) {
+        data = tmp.take();
+        QPixmapCache::insert(key, *this);
+        return true;
     }
 
-    if (ok)
-        QPixmapCache::insert(key, *this);
-
-    return ok;
+    return false;
 }
 
 /*!
@@ -2026,12 +2019,16 @@
     over the one you grab, you get pixels from the overlying window,
     too. The mouse cursor is generally not grabbed.
 
-    Note on X11that if the given \a window doesn't have the same depth
+    Note on X11 that if the given \a window doesn't have the same depth
     as the root window, and another window partially or entirely
     obscures the one you grab, you will \e not get pixels from the
     overlying window.  The contents of the obscured areas in the
     pixmap will be undefined and uninitialized.
 
+    On Windows Vista and above grabbing a layered window, which is
+    created by setting the Qt::WA_TranslucentBackground attribute, will
+    not work. Instead grabbing the desktop widget should work.
+
     \warning In general, grabbing an area outside the screen is not
     safe. This depends on the underlying window system.