[Qt-qml] Dynamically changing Keynaviagtion

Girish Ramakrishnan girish at forwardbias.in
Thu Feb 10 04:55:29 CET 2011


Hi Amit,

On Thu, Feb 10, 2011 at 8:52 AM, Christoper Ham
<christopher.ham at nokia.com> wrote:
> On 02/10/2011 12:08 PM, ext amit shah wrote:
>
> Hi
> I have 3 components
>
>        GroupA{
>            id: groupA;
>            focus: true;
>            KeyNavigation.right:groupB
>
>        }
>
>        GroupB{
>            id: groupB
>             KeyNavigation.left:groupA
>             KeyNavigation.right:groupC
>
>
>        }
>
>        GroupC{
>            id: groupC
>             KeyNavigation.left:groupB
>
>        }
>
> The KeyNavigation is configured as
>
> GroupA <--> GroupB <--> GroupC
>
> and the behavior is as desired.
>
> Is there a way if GroupB is hidden dynamically via code (visible=false)  I
> should be still able to navigate between groupA & groupB.
> That is
> GroupA <--> GroupC
>
> I tried reconfiguring the KeyNavigation for on groupA & groupB on GroupB's
>  onVisibleChanged but was unable to do so.
>
> onVisibleChanged: {
>                 if (groupB.visible){
>                     groupB.KeyNavigation.left=(groupA);
>                     groupB.KeyNavigation.right=(groupC);
>
>                 }
>                 else{
>                    groupA.KeyNavigation.right=groupC;
>                     groupC.KeyNavigation.left=groupA;
>                 }
>             }
>

Note that you also need to restore groupA, groupC KeyNavigation in the
visible case.

>
> thanks
> --amit
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
> Amit,
>
> These changes have been recently made and are available in the latest
> gitorious repo of Qt, but currently not in any of the released versions.
>
> Br,
> Christopher
>

As a workaround, you can still bind (if that's an option):

KeyNavigation.right: groupB.visible ? groupB : groupC // in groupA code

Girish


More information about the Qt-qml mailing list