[Qt-qml] FocusScope gives focus to the last item with focus: true

Girish Ramakrishnan girish at forwardbias.in
Thu Dec 16 17:51:28 CET 2010


Hi Jerome,
Ah. I guess the commit in not yet in the public gitorious repo? Can
you send me (or the list) the latest document. If there is a patch on
some bugreport that is fine too.

Thanks,
Girish

On Thu, Dec 16, 2010 at 9:51 PM,  <jerome.pasion at nokia.com> wrote:
> Hello,
>
> The Keyboard Focus in QML overview  is broken in the 4.7.0 and 4.7.1 release. I've fixed the incorrect document (not yet passed the CI) and I will add information about Item::forceActiveFocus() in there as well.
>
> Cheers,
> Jerome Pasion
>
> ________________________________________
> From: qt-qml-bounces+jerome.pasion=nokia.com at qt.nokia.com [qt-qml-bounces+jerome.pasion=nokia.com at qt.nokia.com] On Behalf Of ext Girish Ramakrishnan [girish at forwardbias.in]
> Sent: Thursday, December 16, 2010 5:03 PM
> To: qt-qml at qt.nokia.com
> Subject: [Qt-qml] FocusScope gives focus to the last item with focus: true
>
> Hi,
> Per the docs (http://doc.qt.nokia.com/4.7-snapshot/qdeclarativefocus.html#qmlfocus),
> "Within each focus scope one element may have Item::focus set to true.
> If more than one Item has the Item::focus property set, the first is
> selected and the others are unset, just like when there are no focus
> scopes.". In the code below, rect2 gets focus which appears to
> contradict what the docs say.
>
> Also, the 'non-working' example in the documentation, works just fine
> (i.e the MyWidget example that shows the expanded QML code on the
> right without using FocusScope). And this appears to be because the
> last 'focus' item got focus.
>
> I am using 4.7.1.
>
> Girish
>
> FocusScope {
>    id: rect
>    width: 100
>    height: 100
>    focus: true
>
>    Rectangle {
>        id: rect1
>        focus: true
>        anchors.fill: parent
>        Keys.onPressed: {
>            console.log('a key was pressed in rect1')
>            }
>    }
>
>    Rectangle {
>        id: rect2
>        focus: true
>        anchors.fill: parent
>        Keys.onPressed: {
>            console.log('a key was pressed in rect2')
>            }
>    }
> }
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>


More information about the Qt-qml mailing list