summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx/qfxitem.cpp')
-rw-r--r--src/declarative/fx/qfxitem.cpp272
1 files changed, 7 insertions, 265 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 481733b..212496c 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -349,22 +349,6 @@ void QFxContents::setItem(QFxItem *item)
*/
/*!
- \fn void QFxItem::visibleChanged()
-
- This signal is emitted when the visibility of the item changes.
-
- \sa setVisible()
-*/
-
-/*!
- \fn void QFxItem::opacityChanged()
-
- This signal is emitted when the opacity of the item changes.
-
- \sa opacity(), setOpacity()
-*/
-
-/*!
\fn void QFxItem::parentChanged()
This signal is emitted when the parent of the item changes.
@@ -460,70 +444,6 @@ void QFxItem::setItemParent(QFxItem *parent)
}
/*!
- \internal
- \property QFxItem::moveToParent
- Playing around with view2view transitions.
- */
-
-/*!
- \internal
- */
-void QFxItem::moveToParent(QFxItem *parent)
-{
- if (parent && itemParent()) {
- QPointF me = itemParent()->mapToScene(QPointF(0,0));
- QPointF them = parent->mapToScene(QPointF(0,0));
-
- QPointF themx = parent->mapToScene(QPointF(1,0));
- QPointF themy = parent->mapToScene(QPointF(0,1));
-
- themx -= them;
- themy -= them;
-
- setItemParent(parent);
-
- // XXX - this is silly and will only work in a few cases
-
- /*
- xDiff = rx * themx_x + ry * themy_x
- yDiff = rx * themx_y + ry * themy_y
- */
-
- qreal rx = 0;
- qreal ry = 0;
- qreal xDiff = them.x() - me.x();
- qreal yDiff = them.y() - me.y();
-
-
- if (themx.x() == 0.) {
- ry = xDiff / themy.x();
- rx = (yDiff - ry * themy.y()) / themx.y();
- } else if (themy.x() == 0.) {
- rx = xDiff / themx.x();
- ry = (yDiff - rx * themx.y()) / themy.y();
- } else if (themx.y() == 0.) {
- ry = yDiff / themy.y();
- rx = (xDiff - ry * themy.x()) / themx.x();
- } else if (themy.y() == 0.) {
- rx = yDiff / themx.y();
- ry = (xDiff - rx * themx.x()) / themy.x();
- } else {
- qreal div = (themy.x() * themx.y() - themy.y() * themx.x());
-
- if (div != 0.)
- rx = (themx.y() * xDiff - themx.x() * yDiff) / div;
-
- if (themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y();
- }
-
- setX(x() - rx);
- setY(y() - ry);
- } else {
- setItemParent(parent);
- }
-}
-
-/*!
Returns the QFxItem parent of this item.
*/
QFxItem *QFxItem::itemParent() const
@@ -1132,14 +1052,6 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event)
}
/*!
- Returns the bounding rectangle of the item in scene coordinates.
-*/
-QRectF QFxItem::sceneBoundingRect() const
-{
- return QRectF(mapToScene(QPointF(0,0)), QSize(width(), height()));
-}
-
-/*!
\qmlproperty string Item::id
This property holds the identifier for the item.
@@ -1156,34 +1068,6 @@ QRectF QFxItem::sceneBoundingRect() const
*/
/*!
- \property QFxItem::id
- This property holds the identifier for the item.
-
- The identifier can be used in bindings and other expressions to
- refer to the item. For example:
-
- \qml
- Text { id: myText; ... }
- Text { text: myText.text }
- \endqml
-
- The identifier is available throughout the \l {components}{component}
- where it is declared. The identifier must be unique in thecomponent.
-*/
-QString QFxItem::id() const
-{
- Q_D(const QFxItem);
- return d->_id;
-}
-
-void QFxItem::setId(const QString &id)
-{
- Q_D(QFxItem);
- setObjectName(id);
- d->_id = id;
-}
-
-/*!
\internal
*/
QFxAnchorLine QFxItem::left() const
@@ -1567,26 +1451,6 @@ void QFxItem::setRotation(qreal rotation)
*/
/*!
- \property QFxItem::opacity
-
- The opacity of the item. Opacity is specified as a number between 0
- (fully transparent) and 1 (fully opaque). The default is 1.
-
- Opacity is an \e inherited attribute. That is, the opacity is
- also applied individually to child items.
-*/
-
-void QFxItem::setOpacity(qreal v)
-{
- if (v == opacity())
- return;
-
- QGraphicsItem::setOpacity(v);
-
- emit opacityChanged();
-}
-
-/*!
Returns a value indicating whether the mouse should
remain with this item.
*/
@@ -1839,50 +1703,6 @@ QList<QFxTransform *> *QFxItem::transform()
return &(d->_transform);
}
-/*!
- Returns true if the item is visible; otherwise returns false.
-
- An item is considered visible if its opacity is not 0.
-*/
-bool QFxItem::isVisible() const
-{
- Q_D(const QFxItem);
- return d->visible;
-}
-
-/*!
- \property QFxItem::visible
-
- This property specifies whether the item is visible or invisible.
-
- Setting visibility to false sets opacity to 0. Setting the
- visibility to true restores the opacity to its previous value.
-
- \sa isVisible()
-*/
-void QFxItem::setVisible(bool visible)
-{
- Q_D(QFxItem);
- if (visible == d->visible)
- return;
-
- d->visible = visible;
- if (visible)
- setOpacity(d->visibleOp);
- else {
- d->visibleOp = opacity();
- setOpacity(0);
- }
-
- emit visibleChanged();
-}
-
-/*! \internal
-*/
-QString QFxItem::propertyInfo() const
-{
- return QString();
-}
/*!
Creates a new child of the given component \a type. The
@@ -2097,8 +1917,9 @@ void QFxItem::childrenChanged()
void QFxItem::setPaintMargin(qreal margin)
{
Q_D(QFxItem);
- if (margin < d->paintmargin)
- update(); // schedule repaint of old boundingRect
+ if (margin == d->paintmargin)
+ return;
+ prepareGeometryChange();
d->paintmargin = margin;
}
@@ -2118,14 +1939,6 @@ void QFxItem::parentChanged(QFxItem *, QFxItem *)
}
/*!
- Returns the item's (0, 0) point relative to its parent.
- */
-QPointF QFxItem::pos() const
-{
- return QPointF(x(),y());
-}
-
-/*!
Returns the item's (0, 0) point mapped to scene coordinates.
*/
QPointF QFxItem::scenePos() const
@@ -2176,50 +1989,6 @@ QPointF QFxItem::transformOriginPoint() const
return d->transformOrigin();
}
-qreal QFxItem::z() const
-{
- return zValue();
-}
-
-void QFxItem::setX(qreal x)
-{
- if (x == this->x())
- return;
-
- qreal oldX = this->x();
-
- QGraphicsItem::setPos(x, y());
-
- geometryChanged(QRectF(this->x(), y(), width(), height()),
- QRectF(oldX, y(), width(), height()));
-}
-
-void QFxItem::setY(qreal y)
-{
- if (y == this->y())
- return;
-
- qreal oldY = this->y();
-
- QGraphicsItem::setPos(x(), y);
-
- geometryChanged(QRectF(x(), this->y(), width(), height()),
- QRectF(x(), oldY, width(), height()));
-}
-
-void QFxItem::setZ(qreal z)
-{
- if (z == this->z())
- return;
-
- if (z < 0)
- setFlag(QGraphicsItem::ItemStacksBehindParent, true);
- else
- setFlag(QGraphicsItem::ItemStacksBehindParent, false);
-
- setZValue(z);
-}
-
qreal QFxItem::width() const
{
Q_D(const QFxItem);
@@ -2235,6 +2004,7 @@ void QFxItem::setWidth(qreal w)
qreal oldWidth = d->width;
+ prepareGeometryChange();
d->width = w;
update();
@@ -2250,6 +2020,7 @@ void QFxItem::setImplicitWidth(qreal w)
qreal oldWidth = d->width;
+ prepareGeometryChange();
d->width = w;
update();
@@ -2278,6 +2049,7 @@ void QFxItem::setHeight(qreal h)
qreal oldHeight = d->height;
+ prepareGeometryChange();
d->height = h;
update();
@@ -2293,6 +2065,7 @@ void QFxItem::setImplicitHeight(qreal h)
qreal oldHeight = d->height;
+ prepareGeometryChange();
d->height = h;
update();
@@ -2306,17 +2079,6 @@ bool QFxItem::heightValid() const
return d->heightValid;
}
-void QFxItem::setPos(const QPointF &point)
-{
- qreal oldX = x();
- qreal oldY = y();
-
- QGraphicsItem::setPos(point);
-
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(oldX, oldY, width(), height()));
-}
-
qreal QFxItem::scale() const
{
Q_D(const QFxItem);
@@ -2340,26 +2102,6 @@ QRect QFxItem::itemBoundingRect()
return boundingRect().toAlignedRect();
}
-QPointF QFxItem::mapFromScene(const QPointF &p) const
-{
- return QGraphicsItem::mapFromScene(p);
-}
-
-QRectF QFxItem::mapFromScene(const QRectF &r) const
-{
- return QGraphicsItem::mapFromScene(r).boundingRect();
-}
-
-QPointF QFxItem::mapToScene(const QPointF &p) const
-{
- return QGraphicsItem::mapToScene(p);
-}
-
-QRectF QFxItem::mapToScene(const QRectF &r) const
-{
- return QGraphicsItem::mapToScene(r).boundingRect();
-}
-
QTransform QFxItem::transform() const
{
Q_D(const QFxItem);