[Qt-qml] Why FocusChange is never emitted?

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Wed Aug 4 14:02:30 CEST 2010


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