src/gui/graphicsview/qgraphicswidget_p.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 14 c0432d11811c
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp	Mon May 03 13:17:34 2010 +0300
@@ -44,6 +44,7 @@
 #ifndef QT_NO_GRAPHICSVIEW
 
 #include <QtCore/qdebug.h>
+#include <QtCore/qnumeric.h>
 #include "qgraphicswidget_p.h"
 #include "qgraphicslayout.h"
 #include "qgraphicsscene_p.h"
@@ -825,6 +826,56 @@
     }
 }
 
+qreal QGraphicsWidgetPrivate::width() const
+{
+    Q_Q(const QGraphicsWidget);
+    return q->geometry().width();
+}
+
+void QGraphicsWidgetPrivate::setWidth(qreal w)
+{
+    if (qIsNaN(w))
+        return;
+    Q_Q(QGraphicsWidget);
+    if (q->geometry().width() == w)
+        return;
+
+    QRectF oldGeom = q->geometry();
+
+    q->setGeometry(QRectF(q->x(), q->y(), w, height()));
+}
+
+void QGraphicsWidgetPrivate::resetWidth()
+{
+    Q_Q(QGraphicsWidget);
+    q->setGeometry(QRectF(q->x(), q->y(), 0, height()));
+}
+
+qreal QGraphicsWidgetPrivate::height() const
+{
+    Q_Q(const QGraphicsWidget);
+    return q->geometry().height();
+}
+
+void QGraphicsWidgetPrivate::setHeight(qreal h)
+{
+    if (qIsNaN(h))
+        return;
+    Q_Q(QGraphicsWidget);
+    if (q->geometry().height() == h)
+        return;
+
+    QRectF oldGeom = q->geometry();
+
+    q->setGeometry(QRectF(q->x(), q->y(), width(), h));
+}
+
+void QGraphicsWidgetPrivate::resetHeight()
+{
+    Q_Q(QGraphicsWidget);
+    q->setGeometry(QRectF(q->x(), q->y(), width(), 0));
+}
+
 QT_END_NAMESPACE
 
 #endif //QT_NO_GRAPHICSVIEW