summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxitem.cpp42
-rw-r--r--src/declarative/fx/qfxitem.h7
-rw-r--r--src/declarative/fx/qfxitem_p.h7
-rw-r--r--src/declarative/util/qfxview.cpp6
4 files changed, 31 insertions, 31 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index a2c744e..962fee2 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -2575,7 +2575,7 @@ bool QFxItem::sceneEvent(QEvent *event)
if (event->type() == QEvent::FocusIn ||
event->type() == QEvent::FocusOut) {
- activeFocusChanged(hasActiveFocus());
+ focusChanged(hasFocus());
}
return rv;
@@ -2756,39 +2756,33 @@ bool QFxItem::heightValid() const
}
/*!
- \qmlproperty bool Item::focus
- This property indicates whether the item has has an active focus request. Set this
- property to true to request active focus.
-*/
-
-bool QFxItem::hasFocus() const
-{
- Q_D(const QFxItem);
- return d->itemIsFocusedInScope;
-}
-
-void QFxItem::setFocus(bool focus)
-{
- if (focus) QGraphicsItem::setFocus(Qt::OtherFocusReason);
- else QGraphicsItem::clearFocus();
-}
+ \qmlproperty bool Item::wantsFocus
-void QFxItemPrivate::focusedInScopeChanged()
+ This property indicates whether the item has has an active focus request.
+*/
+bool QFxItem::wantsFocus() const
{
- Q_Q(QFxItem);
- q->focusChanged(q->hasFocus());
+ return focusItem() != 0;
}
/*!
- \qmlproperty bool Item::activeFocus
- This property indicates whether the item has the active focus.
+ \qmlproperty bool Item::focus
+ This property indicates whether the item has keyboard input focus. Set this
+ property to true to request focus.
*/
-
-bool QFxItem::hasActiveFocus() const
+bool QFxItem::hasFocus() const
{
return QGraphicsItem::hasFocus();
}
+void QFxItem::setFocus(bool focus)
+{
+ if (focus)
+ QGraphicsItem::setFocus(Qt::OtherFocusReason);
+ else
+ QGraphicsItem::clearFocus();
+}
+
/*!
\reimp
*/
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index c6a5311..7ec1ab2 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -89,7 +89,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
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(bool wantsFocus READ wantsFocus NOTIFY wantsFocusChanged)
Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL)
Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
@@ -147,9 +147,9 @@ public:
QRectF boundingRect() const;
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
- virtual bool hasFocus() const;
+ bool wantsFocus() const;
+ bool hasFocus() const;
void setFocus(bool);
- bool hasActiveFocus() const;
bool keepMouseGrab() const;
void setKeepMouseGrab(bool);
@@ -161,6 +161,7 @@ Q_SIGNALS:
void baselineOffsetChanged();
void stateChanged(const QString &);
void focusChanged();
+ void wantsFocusChanged();
void activeFocusChanged();
void parentChanged();
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 054bdc7..b2560ee 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -224,8 +224,11 @@ public:
q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), width, height), oldGeometry);
}
- // Inherited from QGraphcisItemPrivate
- virtual void focusedInScopeChanged();
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void subFocusItemChange()
+ {
+ emit q_func()->wantsFocusChanged();
+ }
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index 2a38cda..19dfe2c 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -498,9 +498,10 @@ void QFxView::paintEvent(QPaintEvent *event)
This virtual function does nothing with the event \a e
in this class.
*/
-void QFxView::focusInEvent(QFocusEvent *)
+void QFxView::focusInEvent(QFocusEvent *e)
{
// Do nothing (do not call QWidget::update())
+ QGraphicsView::focusInEvent(e);
}
@@ -508,9 +509,10 @@ void QFxView::focusInEvent(QFocusEvent *)
This virtual function does nothing with the event \a e
in this class.
*/
-void QFxView::focusOutEvent(QFocusEvent *)
+void QFxView::focusOutEvent(QFocusEvent *e)
{
// Do nothing (do not call QWidget::update())
+ QGraphicsView::focusOutEvent(e);
}
QT_END_NAMESPACE