[Qt-qml] FocusScope gives focus to the last item with focus: true
Stephen Kelly
steveire at gmail.com
Fri Dec 17 19:37:32 CET 2010
Girish Ramakrishnan wrote:
> 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.
The commit will appear here notified to here I'm sure when complete:
http://bugreports.qt.nokia.com/browse/QTBUG-15437
The useful info there so far is that Component became a focus scope after
that doc was written.
Thanks,
Steve.
>
> 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-
j2+ES3AKPrdWk0Htik3J/w at public.gmane.org
>> [qt-qml-bounces+jerome.pasion=nokia.com-
j2+ES3AKPrdWk0Htik3J/w at public.gmane.org]
>> 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