From fc3e138a26f9add4def111e8f6305f1aa674fa05 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 17 Sep 2009 09:48:08 +1000 Subject: Experiment with reset functions for width and height. --- src/declarative/fx/qfxitem.cpp | 14 ++++++++++++++ src/declarative/fx/qfxitem.h | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index c7e807c..dd51aa6 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2688,6 +2688,13 @@ void QFxItem::setWidth(qreal w) QRectF(x(), y(), oldWidth, height())); } +void QFxItem::resetWidth() +{ + Q_D(QFxItem); + d->widthValid = false; + setImplicitWidth(implicitWidth()); +} + qreal QFxItem::implicitWidth() const { Q_D(const QFxItem); @@ -2740,6 +2747,13 @@ void QFxItem::setHeight(qreal h) QRectF(x(), y(), width(), oldHeight)); } +void QFxItem::resetHeight() +{ + Q_D(QFxItem); + d->heightValid = false; + setImplicitHeight(implicitHeight()); +} + qreal QFxItem::implicitHeight() const { Q_D(const QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 9d2113f..b309cb3 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -75,8 +75,8 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QmlList* states READ states DESIGNABLE false) Q_PROPERTY(QmlList* transitions READ transitions DESIGNABLE false) Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) - Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL) - Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL) + Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) + Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL) @@ -134,10 +134,12 @@ public: qreal width() const; void setWidth(qreal); + void resetWidth(); qreal implicitWidth() const; qreal height() const; void setHeight(qreal); + void resetHeight(); qreal implicitHeight() const; TransformOrigin transformOrigin() const; -- cgit v0.12