src/gui/graphicsview/qgraphicswidget_p.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 4 3b1da2848fc7
child 13 c0432d11811c
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp	Mon Mar 15 12:43:09 2010 +0200
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp	Thu Apr 08 14:19:33 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