src/gui/graphicsview/qgraphicswidget.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/graphicsview/qgraphicswidget.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/graphicsview/qgraphicswidget.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -324,6 +324,14 @@
 */
 
 /*!
+
+  \fn QGraphicsWidget::geometryChanged()
+
+  This signal gets emitted whenever the geometry of the item changes
+  \internal
+*/
+
+/*!
     \property QGraphicsWidget::geometry
     \brief the geometry of the widget
 
@@ -334,7 +342,7 @@
     A side effect of calling this function is that the widget will receive
     a move event and a resize event. Also, if the widget has a layout
     assigned, the layout will activate.
-    
+
     \sa geometry(), resize()
 */
 void QGraphicsWidget::setGeometry(const QRectF &rect)
@@ -384,13 +392,17 @@
     }
     QSizeF oldSize = size();
     QGraphicsLayoutItem::setGeometry(newGeom);
-
+    emit geometryChanged();
     // Send resize event
     bool resized = newGeom.size() != oldSize;
     if (resized) {
         QGraphicsSceneResizeEvent re;
         re.setOldSize(oldSize);
         re.setNewSize(newGeom.size());
+        if (oldSize.width() != newGeom.size().width())
+            emit widthChanged();
+        if (oldSize.height() != newGeom.size().height())
+            emit heightChanged();
         QApplication::sendEvent(this, &re);
     }
 }
@@ -562,7 +574,7 @@
 void QGraphicsWidget::unsetWindowFrameMargins()
 {
     Q_D(QGraphicsWidget);
-    if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup && 
+    if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup &&
          (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) {
         QStyleOptionTitleBar bar;
         d->initStyleOptionTitleBar(&bar);
@@ -1139,7 +1151,7 @@
 
     Returns true if \a event has been recognized and processed; otherwise,
     returns false.
-    
+
     \sa event()
 */
 bool QGraphicsWidget::windowFrameEvent(QEvent *event)
@@ -1196,7 +1208,7 @@
     const QRectF r = windowFrameRect();
     if (!r.contains(pos))
         return Qt::NoSection;
-    
+
     const qreal left = r.left();
     const qreal top = r.top();
     const qreal right = r.right();
@@ -2322,5 +2334,5 @@
 #endif
 
 QT_END_NAMESPACE
-        
+
 #endif //QT_NO_GRAPHICSVIEW