42 #include "qglobal.h" |
42 #include "qglobal.h" |
43 |
43 |
44 #ifndef QT_NO_GRAPHICSVIEW |
44 #ifndef QT_NO_GRAPHICSVIEW |
45 |
45 |
46 #include <QtCore/qdebug.h> |
46 #include <QtCore/qdebug.h> |
47 #include <QtCore/qnumeric.h> |
|
48 #include "qgraphicswidget_p.h" |
47 #include "qgraphicswidget_p.h" |
49 #include "qgraphicslayout.h" |
48 #include "qgraphicslayout.h" |
50 #include "qgraphicsscene_p.h" |
49 #include "qgraphicsscene_p.h" |
51 #include <QtGui/qapplication.h> |
50 #include <QtGui/qapplication.h> |
52 #include <QtGui/qgraphicsscene.h> |
51 #include <QtGui/qgraphicsscene.h> |
824 Q_Q(QGraphicsWidget); |
823 Q_Q(QGraphicsWidget); |
825 q->updateGeometry(); |
824 q->updateGeometry(); |
826 } |
825 } |
827 } |
826 } |
828 |
827 |
829 qreal QGraphicsWidgetPrivate::width() const |
|
830 { |
|
831 Q_Q(const QGraphicsWidget); |
|
832 return q->geometry().width(); |
|
833 } |
|
834 |
|
835 void QGraphicsWidgetPrivate::setWidth(qreal w) |
|
836 { |
|
837 if (qIsNaN(w)) |
|
838 return; |
|
839 Q_Q(QGraphicsWidget); |
|
840 if (q->geometry().width() == w) |
|
841 return; |
|
842 |
|
843 QRectF oldGeom = q->geometry(); |
|
844 |
|
845 q->setGeometry(QRectF(q->x(), q->y(), w, height())); |
|
846 } |
|
847 |
|
848 void QGraphicsWidgetPrivate::resetWidth() |
|
849 { |
|
850 Q_Q(QGraphicsWidget); |
|
851 q->setGeometry(QRectF(q->x(), q->y(), 0, height())); |
|
852 } |
|
853 |
|
854 qreal QGraphicsWidgetPrivate::height() const |
|
855 { |
|
856 Q_Q(const QGraphicsWidget); |
|
857 return q->geometry().height(); |
|
858 } |
|
859 |
|
860 void QGraphicsWidgetPrivate::setHeight(qreal h) |
|
861 { |
|
862 if (qIsNaN(h)) |
|
863 return; |
|
864 Q_Q(QGraphicsWidget); |
|
865 if (q->geometry().height() == h) |
|
866 return; |
|
867 |
|
868 QRectF oldGeom = q->geometry(); |
|
869 |
|
870 q->setGeometry(QRectF(q->x(), q->y(), width(), h)); |
|
871 } |
|
872 |
|
873 void QGraphicsWidgetPrivate::resetHeight() |
|
874 { |
|
875 Q_Q(QGraphicsWidget); |
|
876 q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); |
|
877 } |
|
878 |
|
879 QT_END_NAMESPACE |
828 QT_END_NAMESPACE |
880 |
829 |
881 #endif //QT_NO_GRAPHICSVIEW |
830 #endif //QT_NO_GRAPHICSVIEW |