Add some docs, improve scope of var.
authorFrederik Gladhorn <frederik.gladhorn@digia.com>
Mon, 4 Mar 2013 20:45:24 +0000 (21:45 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 14 Mar 2013 16:36:54 +0000 (17:36 +0100)
Change-Id: I62e0b3bb4882f58ba58b3c8d71679e4ad2dbc5a3
Reviewed-by: Caroline Chao <caroline.chao@digia.com>

src/quick/items/qquickitem.cpp
src/quick/items/qquickwindow.cpp

index 022aaa7..0b3d91f 100644 (file)
@@ -1534,6 +1534,11 @@ void QQuickItemPrivate::setAccessibleFlagAndListener()
     }
 }
 
+/*!
+Clears all sub focus items from \a scope.
+If \a focus is true, sets the scope's subFocusItem
+to be this item.
+*/
 void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
 {
     Q_Q(QQuickItem);
index 53b731b..48e2ace 100644 (file)
@@ -608,6 +608,11 @@ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent)
     touchEvent->setTouchPoints(touchPoints);
 }
 
+/*!
+Set the focus inside \a scope to be \a item.
+If the scope contains the active focus item, it will be changed to \a item.
+Calls notifyFocusChangesRecur for all changed items.
+*/
 void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions options)
 {
     Q_Q(QQuickWindow);
@@ -627,13 +632,13 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
     QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : 0;
     QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
 
-    QQuickItem *oldActiveFocusItem = 0;
     QQuickItem *newActiveFocusItem = 0;
 
     QVarLengthArray<QQuickItem *, 20> changed;
 
     // Does this change the active focus?
     if (item == contentItem || (scopePrivate->activeFocus && item->isEnabled())) {
+        QQuickItem *oldActiveFocusItem = 0;
         oldActiveFocusItem = activeFocusItem;
         newActiveFocusItem = item;
         while (newActiveFocusItem->isFocusScope()