src/hbcore/gui/hbmainwindow.cpp
changeset 23 e6ad4ef83b23
parent 21 4633027730f5
child 30 80e4d18b72f5
equal deleted inserted replaced
21:4633027730f5 23:e6ad4ef83b23
  1185     QGraphicsView::drawBackground(painter, rect);
  1185     QGraphicsView::drawBackground(painter, rect);
  1186     // The background item's paint() does not get called automatically so call
  1186     // The background item's paint() does not get called automatically so call
  1187     // it directly and optimize it by setting a proper clipping rectangle.
  1187     // it directly and optimize it by setting a proper clipping rectangle.
  1188     Q_D(HbMainWindow);
  1188     Q_D(HbMainWindow);
  1189     if (d->mBgItem) {
  1189     if (d->mBgItem) {
  1190         // No need to save/restore the painter state here.
  1190         bool restoreState = false;
  1191         if (d->mBgItem->imageMode() != Hb::DoNotDrawBackground &&
  1191         if (d->mBgItem->imageMode() != Hb::DoNotDrawBackground &&
  1192             (!qFuzzyCompare(rect.height(), d->mBgItem->boundingRect().height()) ||
  1192             (!qFuzzyCompare(rect.height(), d->mBgItem->boundingRect().height()) ||
  1193              !qFuzzyCompare(rect.width(), d->mBgItem->boundingRect().width()))) {
  1193              !qFuzzyCompare(rect.width(), d->mBgItem->boundingRect().width()))) {
  1194             painter->setClipRect(rect, Qt::ReplaceClip);
  1194             //Need to save the state since some widget in scene could apply a smaller
       
  1195             //clip than this
       
  1196             restoreState = true;
       
  1197             painter->save();
       
  1198             painter->setClipRect(rect);
  1195         }
  1199         }
  1196         d->mBgItem->paint(painter, 0, 0);
  1200         d->mBgItem->paint(painter, 0, 0);
       
  1201         if (restoreState) {
       
  1202             painter->restore();
       
  1203         }
  1197     }
  1204     }
  1198 }
  1205 }
  1199 
  1206 
  1200 HbRootItem::HbRootItem(QGraphicsItem *parent)
  1207 HbRootItem::HbRootItem(QGraphicsItem *parent)
  1201     : HbWidget(parent)
  1208     : HbWidget(parent)