src/gui/graphicsview/qgraphicswidget.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   316 
   316 
   317     \sa setGeometry(), setTransform()
   317     \sa setGeometry(), setTransform()
   318 */
   318 */
   319 
   319 
   320 /*!
   320 /*!
       
   321     \property QGraphicsWidget::sizePolicy
       
   322     \brief the size policy for the widget
       
   323     \sa sizePolicy(), setSizePolicy(), QWidget::sizePolicy()
       
   324 */
       
   325 
       
   326 /*!
   321     \property QGraphicsWidget::geometry
   327     \property QGraphicsWidget::geometry
   322     \brief the geometry of the widget
   328     \brief the geometry of the widget
   323 
   329 
   324     Sets the item's geometry to \a rect. The item's position and size are
   330     Sets the item's geometry to \a rect. The item's position and size are
   325     modified as a result of calling this function. The item is first moved,
   331     modified as a result of calling this function. The item is first moved,
   377         }
   383         }
   378     }
   384     }
   379     QSizeF oldSize = size();
   385     QSizeF oldSize = size();
   380     QGraphicsLayoutItem::setGeometry(newGeom);
   386     QGraphicsLayoutItem::setGeometry(newGeom);
   381 
   387 
   382     wd->invalidateCachedClipPathRecursively();
       
   383 
       
   384     // Send resize event
   388     // Send resize event
   385     bool resized = newGeom.size() != oldSize;
   389     bool resized = newGeom.size() != oldSize;
   386     if (resized) {
   390     if (resized) {
   387         QGraphicsSceneResizeEvent re;
   391         QGraphicsSceneResizeEvent re;
   388         re.setOldSize(oldSize);
   392         re.setOldSize(oldSize);
   405 
   409 
   406     This convenience function is equivalent to calling setGeometry(QRectF(
   410     This convenience function is equivalent to calling setGeometry(QRectF(
   407     \a x, \a y, \a w, \a h)).
   411     \a x, \a y, \a w, \a h)).
   408 
   412 
   409     \sa geometry(), resize()
   413     \sa geometry(), resize()
       
   414 */
       
   415 
       
   416 /*!
       
   417     \property QGraphicsWidget::minimumSize
       
   418     \brief the minimum size of the widget
       
   419 
       
   420     \sa setMinimumSize(), minimumSize(), preferredSize, maximumSize
       
   421 */
       
   422 
       
   423 /*!
       
   424     \property QGraphicsWidget::preferredSize
       
   425     \brief the preferred size of the widget
       
   426 
       
   427     \sa setPreferredSize(), preferredSize(), minimumSize, maximumSize
       
   428 */
       
   429 
       
   430 /*!
       
   431     \property QGraphicsWidget::maximumSize
       
   432     \brief the maximum size of the widget
       
   433 
       
   434     \sa setMaximumSize(), maximumSize(), minimumSize, preferredSize
   410 */
   435 */
   411 
   436 
   412 /*!
   437 /*!
   413     Sets the widget's contents margins to \a left, \a top, \a right and \a
   438     Sets the widget's contents margins to \a left, \a top, \a right and \a
   414     bottom.
   439     bottom.
  1027             d->inSetPos = 0 ;
  1052             d->inSetPos = 0 ;
  1028         }
  1053         }
  1029         break;
  1054         break;
  1030     case ItemParentChange: {
  1055     case ItemParentChange: {
  1031         QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value);
  1056         QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value);
  1032         d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0);
  1057         d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0, scene());
  1033 
  1058 
  1034         // Deliver ParentAboutToChange.
  1059         // Deliver ParentAboutToChange.
  1035         QEvent event(QEvent::ParentAboutToChange);
  1060         QEvent event(QEvent::ParentAboutToChange);
  1036         QApplication::sendEvent(this, &event);
  1061         QApplication::sendEvent(this, &event);
  1037         break;
  1062         break;
  1274         hideEvent(static_cast<QHideEvent *>(event));
  1299         hideEvent(static_cast<QHideEvent *>(event));
  1275         break;
  1300         break;
  1276     case QEvent::Polish:
  1301     case QEvent::Polish:
  1277         polishEvent();
  1302         polishEvent();
  1278         d->polished = true;
  1303         d->polished = true;
  1279         d->updateFont(d->font);
  1304         if (!d->font.isCopyOf(QApplication::font()))
       
  1305             d->updateFont(d->font);
  1280         break;
  1306         break;
  1281     case QEvent::WindowActivate:
  1307     case QEvent::WindowActivate:
  1282     case QEvent::WindowDeactivate:
  1308     case QEvent::WindowDeactivate:
  1283         update();
  1309         update();
  1284         break;
  1310         break;
  1350     Q_D(QGraphicsWidget);
  1376     Q_D(QGraphicsWidget);
  1351     switch (event->type()) {
  1377     switch (event->type()) {
  1352     case QEvent::StyleChange:
  1378     case QEvent::StyleChange:
  1353         // ### Don't unset if the margins are explicitly set.
  1379         // ### Don't unset if the margins are explicitly set.
  1354         unsetWindowFrameMargins();
  1380         unsetWindowFrameMargins();
       
  1381         if (d->layout)
       
  1382             d->layout->invalidate();
  1355     case QEvent::FontChange:
  1383     case QEvent::FontChange:
  1356         update();
  1384         update();
  1357         updateGeometry();
  1385         updateGeometry();
  1358         break;
  1386         break;
  1359     case QEvent::PaletteChange:
  1387     case QEvent::PaletteChange: