src/gui/graphicsview/qgraphicswidget.cpp
changeset 22 79de32ba3296
parent 19 fcece45ef507
child 25 e24348a560a6
equal deleted inserted replaced
19:fcece45ef507 22:79de32ba3296
   322     \brief the size policy for the widget
   322     \brief the size policy for the widget
   323     \sa sizePolicy(), setSizePolicy(), QWidget::sizePolicy()
   323     \sa sizePolicy(), setSizePolicy(), QWidget::sizePolicy()
   324 */
   324 */
   325 
   325 
   326 /*!
   326 /*!
   327 
       
   328   \fn QGraphicsWidget::geometryChanged()
       
   329 
       
   330   This signal gets emitted whenever the geometry of the item changes
       
   331   \internal
       
   332 */
       
   333 
       
   334 /*!
       
   335     \property QGraphicsWidget::geometry
   327     \property QGraphicsWidget::geometry
   336     \brief the geometry of the widget
   328     \brief the geometry of the widget
   337 
   329 
   338     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
   339     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,
   390             return;
   382             return;
   391         }
   383         }
   392     }
   384     }
   393     QSizeF oldSize = size();
   385     QSizeF oldSize = size();
   394     QGraphicsLayoutItem::setGeometry(newGeom);
   386     QGraphicsLayoutItem::setGeometry(newGeom);
   395     emit geometryChanged();
   387 
   396     // Send resize event
   388     // Send resize event
   397     bool resized = newGeom.size() != oldSize;
   389     bool resized = newGeom.size() != oldSize;
   398     if (resized) {
   390     if (resized) {
   399         QGraphicsSceneResizeEvent re;
   391         QGraphicsSceneResizeEvent re;
   400         re.setOldSize(oldSize);
   392         re.setOldSize(oldSize);
   401         re.setNewSize(newGeom.size());
   393         re.setNewSize(newGeom.size());
   402         if (oldSize.width() != newGeom.size().width())
       
   403             emit widthChanged();
       
   404         if (oldSize.height() != newGeom.size().height())
       
   405             emit heightChanged();
       
   406         QApplication::sendEvent(this, &re);
   394         QApplication::sendEvent(this, &re);
   407     }
   395     }
   408 }
   396 }
   409 
   397 
   410 /*!
   398 /*!
  1077         // Deliver ParentChange.
  1065         // Deliver ParentChange.
  1078         QEvent event(QEvent::ParentChange);
  1066         QEvent event(QEvent::ParentChange);
  1079         QApplication::sendEvent(this, &event);
  1067         QApplication::sendEvent(this, &event);
  1080         break;
  1068         break;
  1081     }
  1069     }
  1082     case ItemCursorChange: {
  1070     case ItemCursorHasChanged: {
  1083         // Deliver CursorChange.
  1071         // Deliver CursorChange.
  1084         QEvent event(QEvent::CursorChange);
  1072         QEvent event(QEvent::CursorChange);
  1085         QApplication::sendEvent(this, &event);
  1073         QApplication::sendEvent(this, &event);
  1086         break;
  1074         break;
  1087     }
  1075     }
  1088     case ItemToolTipChange: {
  1076     case ItemToolTipHasChanged: {
  1089         // Deliver ToolTipChange.
  1077         // Deliver ToolTipChange.
  1090         QEvent event(QEvent::ToolTipChange);
  1078         QEvent event(QEvent::ToolTipChange);
  1091         QApplication::sendEvent(this, &event);
  1079         QApplication::sendEvent(this, &event);
  1092         break;
  1080         break;
  1093     }
  1081     }