summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/fx/qfxflickable.cpp2
-rw-r--r--src/declarative/fx/qfxitem.cpp101
-rw-r--r--src/declarative/fx/qfxitem.h61
-rw-r--r--src/declarative/fx/qfxitem_p.h5
-rw-r--r--src/declarative/fx/qfxpainteditem.cpp6
-rw-r--r--src/declarative/fx/qfxpathview.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h4
7 files changed, 33 insertions, 150 deletions
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index 24f6d72..1db6e8b 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -1019,7 +1019,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxFlickable);
QGraphicsSceneMouseEvent mouseEvent(event->type());
- QRectF myRect = mapToScene(QRectF(0, 0, width(), height()));
+ QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect();
QFxItem *grabber = static_cast<QFxItem*>(mouseGrabberItem());
if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
mouseEvent.setAccepted(false);
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index c439032..90595ff 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.
@@ -1068,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.
@@ -1503,26 +1479,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.
*/
@@ -1775,43 +1731,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
*/
@@ -2281,26 +2200,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);
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 53992d3..ddd3752 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -100,7 +100,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_INTERFACES(QmlParserStatus)
Q_PROPERTY(QFxItem * parent READ itemParent WRITE setItemParent NOTIFY parentChanged DESIGNABLE false FINAL)
- Q_PROPERTY(QString id READ id WRITE setId)
+ Q_PROPERTY(QString id READ id WRITE setId) // ### remove
Q_PROPERTY(QmlList<QFxItem *>* children READ children DESIGNABLE false)
Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false)
Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
@@ -109,9 +109,9 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
- Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged)
- Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged)
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
+ Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) // ### name? Move to own class?
+ Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) // ### see above
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) // ### use method in QGO
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
Q_PROPERTY(qreal z READ z WRITE setZ FINAL)
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL)
@@ -124,15 +124,13 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
Q_PROPERTY(QFxAnchorLine baseline READ baseline CONSTANT FINAL)
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
- Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
- Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
- Q_PROPERTY(bool clip READ clip WRITE setClip)
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) // ## remove me
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) // ### remove me
+ Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
- Q_PROPERTY(QList<QFxTransform *>* transform READ transform)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
- Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
+ Q_PROPERTY(QList<QFxTransform *>* transform READ transform) // ## QGI/QGO
+ Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // movbe to QGI
Q_ENUMS(TransformOrigin)
Q_CLASSINFO("DefaultProperty", "data")
@@ -160,11 +158,11 @@ public:
QFxItem(QFxItem *parent = 0);
virtual ~QFxItem();
- QFxItem *itemParent() const;
+ QFxItem *itemParent() const; // ### remove me
QFxItem *parentItem() const;
- void setItemParent(QFxItem *parent);
+ void setItemParent(QFxItem *parent); // ## setParentItem
- QString id() const;
+ QString id() const; // ### remove me
void setId(const QString &);
QmlList<QObject *> *data();
@@ -199,21 +197,14 @@ public:
qreal scale() const;
void setScale(qreal);
- void setOpacity(qreal);
-
QList<QFxTransform *> *transform();
- bool isVisible() const;
- void setVisible(bool);
-
- virtual QString propertyInfo() const;
+ virtual QString propertyInfo() const; // ### unused, remove me
bool isClassComplete() const;
bool isComponentComplete() const;
- QRectF sceneBoundingRect() const;
-
- void updateTransform();
+ void updateTransform(); // ### private!
bool keepMouseGrab() const;
void setKeepMouseGrab(bool);
@@ -231,13 +222,13 @@ public:
qreal width() const;
void setWidth(qreal);
void setImplicitWidth(qreal);
- bool widthValid() const;
+ bool widthValid() const; // ### better name?
qreal height() const;
void setHeight(qreal);
void setImplicitHeight(qreal);
- bool heightValid() const;
+ bool heightValid() const; // ### better name?
- QPointF scenePos() const;
+ QPointF scenePos() const; // ### remove me
TransformOrigin transformOrigin() const;
void setTransformOrigin(TransformOrigin);
@@ -245,19 +236,14 @@ public:
void setParent(QFxItem *);
- QRect itemBoundingRect();
+ QRect itemBoundingRect(); // ### remove me
void setPaintMargin(qreal margin);
QRectF boundingRect() const;
virtual void paintContents(QPainter &);
- QPointF mapFromScene(const QPointF &) const;
- QRectF mapFromScene(const QRectF &) const;
- QPointF mapToScene(const QPointF &) const;
- QRectF mapToScene(const QRectF &) const;
-
- QTransform transform() const;
- void setTransform(const QTransform &);
+ QTransform transform() const; // ### remove me
+ void setTransform(const QTransform &); // ### remove me
QFxItem *mouseGrabberItem() const;
@@ -268,7 +254,7 @@ public:
bool hasActiveFocus() const;
- static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont());
+ static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); // ### remove me, make private for now
QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy
@@ -289,8 +275,6 @@ Q_SIGNALS:
void keyRelease(QFxKeyEvent *event);
void rotationChanged();
void scaleChanged();
- void opacityChanged();
- void visibleChanged();
void qmlChanged();
void newChildCreated(const QString &url, QScriptValue);
@@ -323,6 +307,7 @@ protected:
QFxItem(QFxItemPrivate &dd, QFxItem *parent = 0);
private:
+ // ### public?
QFxAnchorLine left() const;
QFxAnchorLine right() const;
QFxAnchorLine horizontalCenter() const;
@@ -331,6 +316,7 @@ private:
QFxAnchorLine verticalCenter() const;
QFxAnchorLine baseline() const;
+ // ### move to d-pointer
void init(QFxItem *parent);
friend class QmlStatePrivate;
friend class QFxAnchors;
@@ -340,6 +326,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QFxItem::Options)
+// ### move to QGO
template<typename T>
T qobject_cast(QGraphicsItem *item)
{
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index eddeb9b..1242703 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -76,7 +76,7 @@ public:
: _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0),
_baselineOffset(0), _rotation(0.),
_classComplete(true), _componentComplete(true), _keepMouse(false),
- visible(true), _anchorLines(0), visibleOp(1),
+ _anchorLines(0),
_stateGroup(0), canvas(0), origin(QFxItem::TopLeft),
options(QFxItem::NoOption),
widthValid(false), heightValid(false), width(0), height(0),
@@ -151,7 +151,6 @@ public:
bool _classComplete:1;
bool _componentComplete:1;
bool _keepMouse:1;
- bool visible:1;
QmlChildren _qmlChildren;
@@ -173,8 +172,6 @@ public:
return _anchorLines;
}
- float visibleOp;
-
QmlStateGroup *states();
QmlStateGroup *_stateGroup;
diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp
index 7ff3361..a4055eb 100644
--- a/src/declarative/fx/qfxpainteditem.cpp
+++ b/src/declarative/fx/qfxpainteditem.cpp
@@ -224,11 +224,11 @@ void QFxPaintedItem::paintContents(QPainter &p)
p.setRenderHints(QPainter::SmoothPixmapTransform, true);
QRectF clipf = p.clipRegion().boundingRect();
if (clipf.isEmpty())
- clipf = mapToScene(content); // ### Inefficient: Maps toScene and then fromScene
+ clipf = mapToScene(content).boundingRect(); // ### Inefficient: Maps toScene and then fromScene
else
- clipf = mapToScene(clipf);
+ clipf = mapToScene(clipf).boundingRect();
- const QRect clip = mapFromScene(clipf).toRect();
+ const QRect clip = mapFromScene(clipf).boundingRect().toRect();
QRegion topaint(clip);
topaint &= content;
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 3c61050..47364d0 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -411,7 +411,7 @@ void QFxPathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
int idx = 0;
for (; idx < d->items.count(); ++idx) {
QRectF rect = d->items.at(idx)->boundingRect();
- rect = d->items.at(idx)->mapToScene(rect);
+ rect = d->items.at(idx)->mapToScene(rect).boundingRect();
if (rect.contains(scenePoint))
break;
}
@@ -495,7 +495,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxPathView);
QGraphicsSceneMouseEvent mouseEvent(event->type());
- QRectF myRect = mapToScene(QRectF(0, 0, width(), height()));
+ QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect();
QFxItem *grabber = static_cast<QFxItem*>(mouseGrabberItem());
if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
mouseEvent.setAccepted(false);
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 7240eaa..6012053 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -510,9 +510,9 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_OBJECT
Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false)
Q_PROPERTY(QString id READ objectName WRITE setObjectName)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)