summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfxanchors.cpp14
-rw-r--r--src/declarative/fx/qfxanchors.h3
-rw-r--r--src/declarative/fx/qfxanchors_p.h4
-rw-r--r--src/declarative/fx/qfxitem.cpp26
-rw-r--r--src/declarative/fx/qfxitem.h7
-rw-r--r--src/declarative/fx/qfxitem_p.h2
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp9
7 files changed, 36 insertions, 29 deletions
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 9093c8e..286a0fc 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -237,7 +237,19 @@ void QFxAnchorsPrivate::remDepend(QFxItem *item)
bool QFxAnchorsPrivate::isItemComplete() const
{
- return item->isComponentComplete();
+ return componentComplete;
+}
+
+void QFxAnchors::classBegin()
+{
+ Q_D(QFxAnchors);
+ d->componentComplete = false;
+}
+
+void QFxAnchors::componentComplete()
+{
+ Q_D(QFxAnchors);
+ d->componentComplete = true;
}
void QFxAnchorsPrivate::setItemHeight(qreal v)
diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h
index c11080c..a1f5db8 100644
--- a/src/declarative/fx/qfxanchors.h
+++ b/src/declarative/fx/qfxanchors.h
@@ -147,6 +147,9 @@ public:
void setItem(QFxItem *item);
+ void classBegin();
+ void componentComplete();
+
Q_SIGNALS:
void leftMarginChanged();
void rightMarginChanged();
diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h
index a7c904b..7ce0952 100644
--- a/src/declarative/fx/qfxanchors_p.h
+++ b/src/declarative/fx/qfxanchors_p.h
@@ -66,7 +66,8 @@ public:
: updatingMe(false), updatingHorizontalAnchor(0),
updatingVerticalAnchor(0), item(0), usedAnchors(0), fill(0),
centeredIn(0), leftMargin(0), rightMargin(0), topMargin(0),
- bottomMargin(0), vCenterOffset(0), hCenterOffset(0)
+ bottomMargin(0), vCenterOffset(0), hCenterOffset(0),
+ componentComplete(true)
{
}
@@ -126,6 +127,7 @@ public:
qreal vCenterOffset;
qreal hCenterOffset;
+ bool componentComplete;
};
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 1bf3140..d88b3af 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -1725,6 +1725,8 @@ void QFxItem::classBegin()
d->_componentComplete = false;
if (d->_stateGroup)
d->_stateGroup->classBegin();
+ if (d->_anchors)
+ d->_anchors->classBegin();
}
/*!
@@ -1743,8 +1745,10 @@ void QFxItem::componentComplete()
d->_componentComplete = true;
if (d->_stateGroup)
d->_stateGroup->componentComplete();
- if (d->_anchors)
- d->anchors()->d_func()->updateOnComplete();
+ if (d->_anchors) {
+ d->_anchors->componentComplete();
+ d->_anchors->d_func()->updateOnComplete();
+ }
}
QmlStateGroup *QFxItemPrivate::states()
@@ -2164,22 +2168,4 @@ void QFxItemPrivate::gvAddMouseFilter()
q->installSceneEventFilter(q);
}
-QPixmap QFxItem::string(const QString &str, const QColor &c, const QFont &f)
-{
- QFontMetrics fm(f);
- QSize size(fm.width(str), fm.height()*(str.count(QLatin1Char('\n'))+1)); //fm.boundingRect(str).size();
- QPixmap img(size);
- img.fill(Qt::transparent);
- QPainter p(&img);
- p.setPen(c);
- p.setFont(f);
- p.drawText(img.rect(), Qt::AlignVCenter, str);
- return img;
-}
-
-QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const
-{
- return QGraphicsItem::inputMethodQuery(query);
-}
-
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 5252009..36845a2 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -208,8 +208,6 @@ public:
QmlList<QGraphicsTransform *> *transform();
- bool isComponentComplete() const;
-
bool keepMouseGrab() const;
void setKeepMouseGrab(bool);
@@ -241,10 +239,6 @@ public:
bool hasActiveFocus() const;
- 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
-
public Q_SLOTS:
void newChild(const QString &url);
@@ -266,6 +260,7 @@ Q_SIGNALS:
void newChildCreated(const QString &url, QScriptValue);
protected:
+ bool isComponentComplete() const;
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
virtual void childrenChanged();
virtual bool sceneEventFilter(QGraphicsItem *, QEvent *);
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index c600fbf..77d0673 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -144,6 +144,8 @@ public:
Q_Q(QFxItem);
_anchors = new QFxAnchors;
_anchors->setItem(q);
+ if (!_componentComplete)
+ _anchors->classBegin();
}
return _anchors;
}
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 13f4bfb..968ff09 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -181,10 +181,17 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e)
QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const
{
+ struct QFxItemAccessor : public QFxItem {
+ public:
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const {
+ return QGraphicsItem::inputMethodQuery(query);
+ }
+ };
+
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
if (i && (i->options() & AcceptsInputMethods) && i == d->imeItem) { //### how robust is i == d->imeItem check?
- QVariant v = i->inputMethodQuery(query);
+ QVariant v = ((QFxItemAccessor*)i)->inputMethodQuery(query);
if (v.type() == QVariant::RectF)
v = mapRectFromItem(i, v.toRectF()); //### cost?
return v;