Fix Qt5 To-Do's in QGraphicsItem
- Merge isObscured() - Deprecate and inline obsolete methods - Correct outdated documentation Change-Id: I4eb29df78785794c6d134bf9c2f5e0f3c3d6a29f Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
parent
ce6525efd8
commit
d76de69b4b
@ -1707,16 +1707,13 @@ void QGraphicsItem::setParentItem(QGraphicsItem *newParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn QList<QGraphicsItem *> QGraphicsItem::children() const
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use childItems() instead.
|
Use childItems() instead.
|
||||||
|
|
||||||
\sa setParentItem()
|
\sa setParentItem()
|
||||||
*/
|
*/
|
||||||
QList<QGraphicsItem *> QGraphicsItem::children() const
|
|
||||||
{
|
|
||||||
return childItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.4
|
\since 4.4
|
||||||
@ -2973,14 +2970,11 @@ bool QGraphicsItem::acceptHoverEvents() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn bool QGraphicsItem::acceptsHoverEvents() const
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Call acceptHoverEvents() instead.
|
Call acceptHoverEvents() instead.
|
||||||
*/
|
*/
|
||||||
bool QGraphicsItem::acceptsHoverEvents() const
|
|
||||||
{
|
|
||||||
return d_ptr->acceptsHover;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.4
|
\since 4.4
|
||||||
@ -3025,14 +3019,11 @@ void QGraphicsItem::setAcceptHoverEvents(bool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn void QGraphicsItem::setAcceptsHoverEvents(bool enabled)
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use setAcceptHoverEvents(\a enabled) instead.
|
Use setAcceptHoverEvents(\a enabled) instead.
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::setAcceptsHoverEvents(bool enabled)
|
|
||||||
{
|
|
||||||
setAcceptHoverEvents(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! \since 4.6
|
/*! \since 4.6
|
||||||
|
|
||||||
@ -4442,6 +4433,7 @@ void QGraphicsItem::resetTransform()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn void QGraphicsItem::rotate(qreal angle)
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use
|
Use
|
||||||
@ -4462,12 +4454,9 @@ void QGraphicsItem::resetTransform()
|
|||||||
|
|
||||||
\sa setTransform(), transform(), scale(), shear(), translate()
|
\sa setTransform(), transform(), scale(), shear(), translate()
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::rotate(qreal angle)
|
|
||||||
{
|
|
||||||
setTransform(QTransform().rotate(angle), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn void QGraphicsItem::scale(qreal sx, qreal sy)
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use
|
Use
|
||||||
@ -4488,12 +4477,9 @@ void QGraphicsItem::rotate(qreal angle)
|
|||||||
|
|
||||||
\sa setTransform(), transform()
|
\sa setTransform(), transform()
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::scale(qreal sx, qreal sy)
|
|
||||||
{
|
|
||||||
setTransform(QTransform::fromScale(sx, sy), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn void QGraphicsItem::shear(qreal sh, qreal sv)
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use
|
Use
|
||||||
@ -4508,12 +4494,9 @@ void QGraphicsItem::scale(qreal sx, qreal sy)
|
|||||||
|
|
||||||
\sa setTransform(), transform()
|
\sa setTransform(), transform()
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::shear(qreal sh, qreal sv)
|
|
||||||
{
|
|
||||||
setTransform(QTransform().shear(sh, sv), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn void QGraphicsItem::translate(qreal dx, qreal dy)
|
||||||
\obsolete
|
\obsolete
|
||||||
|
|
||||||
Use setPos() or setTransformOriginPoint() instead. For identical
|
Use setPos() or setTransformOriginPoint() instead. For identical
|
||||||
@ -4531,10 +4514,6 @@ void QGraphicsItem::shear(qreal sh, qreal sv)
|
|||||||
|
|
||||||
\sa setTransform(), transform()
|
\sa setTransform(), transform()
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::translate(qreal dx, qreal dy)
|
|
||||||
{
|
|
||||||
setTransform(QTransform::fromTranslate(dx, dy), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
This virtual function is called twice for all items by the
|
This virtual function is called twice for all items by the
|
||||||
@ -5061,21 +5040,6 @@ QList<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode)
|
|||||||
return QList<QGraphicsItem *>();
|
return QList<QGraphicsItem *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns true if this item's bounding rect is completely obscured by the
|
|
||||||
opaque shape of any of colliding items above it (i.e., with a higher Z
|
|
||||||
value than this item).
|
|
||||||
|
|
||||||
Its implementation is based on calling isObscuredBy(), which you can
|
|
||||||
reimplement to provide a custom obscurity algorithm.
|
|
||||||
|
|
||||||
\sa opaqueArea()
|
|
||||||
*/
|
|
||||||
bool QGraphicsItem::isObscured() const
|
|
||||||
{
|
|
||||||
return isObscured(QRectF());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
@ -5100,9 +5064,6 @@ static bool qt_QGraphicsItem_isObscured(const QGraphicsItem *item,
|
|||||||
Returns true if \a rect is completely obscured by the opaque shape of any
|
Returns true if \a rect is completely obscured by the opaque shape of any
|
||||||
of colliding items above it (i.e., with a higher Z value than this item).
|
of colliding items above it (i.e., with a higher Z value than this item).
|
||||||
|
|
||||||
Unlike the default isObscured() function, this function does not call
|
|
||||||
isObscuredBy().
|
|
||||||
|
|
||||||
\sa opaqueArea()
|
\sa opaqueArea()
|
||||||
*/
|
*/
|
||||||
bool QGraphicsItem::isObscured(const QRectF &rect) const
|
bool QGraphicsItem::isObscured(const QRectF &rect) const
|
||||||
|
@ -180,7 +180,9 @@ public:
|
|||||||
QGraphicsWidget *window() const;
|
QGraphicsWidget *window() const;
|
||||||
QGraphicsItem *panel() const;
|
QGraphicsItem *panel() const;
|
||||||
void setParentItem(QGraphicsItem *parent);
|
void setParentItem(QGraphicsItem *parent);
|
||||||
QList<QGraphicsItem *> children() const; // ### obsolete
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
|
QT_DEPRECATED inline QList<QGraphicsItem *> children() const { return childItems(); }
|
||||||
|
#endif
|
||||||
QList<QGraphicsItem *> childItems() const;
|
QList<QGraphicsItem *> childItems() const;
|
||||||
bool isWidget() const;
|
bool isWidget() const;
|
||||||
bool isWindow() const;
|
bool isWindow() const;
|
||||||
@ -242,9 +244,10 @@ public:
|
|||||||
|
|
||||||
Qt::MouseButtons acceptedMouseButtons() const;
|
Qt::MouseButtons acceptedMouseButtons() const;
|
||||||
void setAcceptedMouseButtons(Qt::MouseButtons buttons);
|
void setAcceptedMouseButtons(Qt::MouseButtons buttons);
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
bool acceptsHoverEvents() const; // ### obsolete
|
QT_DEPRECATED inline bool acceptsHoverEvents() const { return acceptHoverEvents(); }
|
||||||
void setAcceptsHoverEvents(bool enabled); // ### obsolete
|
QT_DEPRECATED inline void setAcceptsHoverEvents(bool enabled) { setAcceptHoverEvents(enabled); }
|
||||||
|
#endif
|
||||||
bool acceptHoverEvents() const;
|
bool acceptHoverEvents() const;
|
||||||
void setAcceptHoverEvents(bool enabled);
|
void setAcceptHoverEvents(bool enabled);
|
||||||
bool acceptTouchEvents() const;
|
bool acceptTouchEvents() const;
|
||||||
@ -299,12 +302,12 @@ public:
|
|||||||
QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const;
|
QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const;
|
||||||
void setTransform(const QTransform &matrix, bool combine = false);
|
void setTransform(const QTransform &matrix, bool combine = false);
|
||||||
void resetTransform();
|
void resetTransform();
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
void rotate(qreal angle); // ### obsolete
|
QT_DEPRECATED inline void rotate(qreal angle) { setTransform(QTransform().rotate(angle), true); }
|
||||||
void scale(qreal sx, qreal sy); // ### obsolete
|
QT_DEPRECATED inline void scale(qreal sx, qreal sy) { setTransform(QTransform::fromScale(sx, sy), true); }
|
||||||
void shear(qreal sh, qreal sv); // ### obsolete
|
QT_DEPRECATED inline void shear(qreal sh, qreal sv) { setTransform(QTransform().shear(sh, sv), true); }
|
||||||
void translate(qreal dx, qreal dy); // ### obsolete
|
QT_DEPRECATED inline void translate(qreal dx, qreal dy) { setTransform(QTransform::fromTranslate(dx, dy), true); }
|
||||||
|
#endif
|
||||||
void setRotation(qreal angle);
|
void setRotation(qreal angle);
|
||||||
qreal rotation() const;
|
qreal rotation() const;
|
||||||
|
|
||||||
@ -337,8 +340,7 @@ public:
|
|||||||
virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
||||||
virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
||||||
QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
|
||||||
bool isObscured() const;
|
bool isObscured(const QRectF &rect = QRectF()) const;
|
||||||
bool isObscured(const QRectF &rect) const; // ### Qt 5: merge with isObscured(), add QRectF arg to isObscuredBy()
|
|
||||||
inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const;
|
inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const;
|
||||||
virtual bool isObscuredBy(const QGraphicsItem *item) const;
|
virtual bool isObscuredBy(const QGraphicsItem *item) const;
|
||||||
virtual QPainterPath opaqueArea() const;
|
virtual QPainterPath opaqueArea() const;
|
||||||
@ -568,7 +570,6 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
|
|||||||
public:
|
public:
|
||||||
QGraphicsObject(QGraphicsItem *parent = 0);
|
QGraphicsObject(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
// ### Qt 5: Disambiguate
|
|
||||||
#ifdef Q_NO_USING_KEYWORD
|
#ifdef Q_NO_USING_KEYWORD
|
||||||
const QObjectList &children() const { return QObject::children(); }
|
const QObjectList &children() const { return QObject::children(); }
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user