src/hbcore/gui/hbmainwindow.cpp
changeset 23 e6ad4ef83b23
parent 21 4633027730f5
child 30 80e4d18b72f5
--- a/src/hbcore/gui/hbmainwindow.cpp	Wed Aug 18 10:05:37 2010 +0300
+++ b/src/hbcore/gui/hbmainwindow.cpp	Thu Sep 02 20:44:51 2010 +0300
@@ -1187,13 +1187,20 @@
     // it directly and optimize it by setting a proper clipping rectangle.
     Q_D(HbMainWindow);
     if (d->mBgItem) {
-        // No need to save/restore the painter state here.
+        bool restoreState = false;
         if (d->mBgItem->imageMode() != Hb::DoNotDrawBackground &&
             (!qFuzzyCompare(rect.height(), d->mBgItem->boundingRect().height()) ||
              !qFuzzyCompare(rect.width(), d->mBgItem->boundingRect().width()))) {
-            painter->setClipRect(rect, Qt::ReplaceClip);
+            //Need to save the state since some widget in scene could apply a smaller
+            //clip than this
+            restoreState = true;
+            painter->save();
+            painter->setClipRect(rect);
         }
         d->mBgItem->paint(painter, 0, 0);
+        if (restoreState) {
+            painter->restore();
+        }
     }
 }