[Qt-qml] Why FocusChange is never emitted?
Gregory Schlomoff
gregory.schlomoff at gmail.com
Wed Aug 4 15:14:00 CEST 2010
Further investigation made clear that onFocusChange is not being
emitted when the item is inside a FocusScope. I filed a bug for that:
http://bugreports.qt.nokia.com/browse/QTBUG-12649
Thanks.
Greg
On Wed, Aug 4, 2010 at 7:02 PM, <aaron.kennedy at nokia.com> wrote:
> Hi,
>
> Sounds broken - please file a bug.
>
> Cheers,
>
> Aaron
>
> On 04/08/2010, at 9:52 PM, ext Gregory Schlomoff <gregory.schlomoff at gmail.com> wrote:
>
>> Hello everyone,
>>
>> We are using the latest version of Qt 4.7 from the repository, and the
>> focus works very well, in a very intuitive way, much better than with
>> the old "wantsFocus".
>>
>> Except for one thing: onFocusChanged never gets called.
>>
>> Sure, we could use onActiveFocusChanged instead, and indeed, in most
>> cases, that's what we need. But there are some edge cases when you
>> actually want onFocusChanged.
>>
>> Example: we have an app with a left panel and a right panel. Each
>> panel is inside a FocusScope. We use focus to track wich item should
>> be highlighted in the left panel. To do that, we simply have a
>> "highlighted" State on each item that is activated when they get the
>> focus. It should work, but it doesn't, because focusChanged is not
>> emitted, so the states don't get updated. If instead whe bind our
>> State to activeFocus, it works, but the highlight will disappear as
>> soon as an item from the right side gets active focus.
>>
>> Example:
>>
>> Rectangle {
>> color: "grey"
>> State {name: "highlighted; when: activeFocus // works, but will lose
>> the highlight
>> PropertyChange [...]
>> }
>>
>> Rectangle {
>> color: "grey"
>> State {name: "highlighted; when: focus // is what we need, but
>> doesn't gets notified of changes
>> PropertyChange [...]
>> }
>>
>>
>> What are your thoughts on this? Is there a reason
>> for focusChanged not to be emitted?
>>
>> Thanks!
>>
>> Greg
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
More information about the Qt-qml
mailing list