Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Force Key Navigation focus [solved]
Forum Updated to NodeBB v4.3 + New Features

Force Key Navigation focus [solved]

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dstudentx
    wrote on last edited by
    #1

    My key nav moves fine moving forward through states but once I go back my key nav. stays in the previous state.
    Is there a way to force the focus of the key nav?

    Something like
    @
    Keys.OnPressed {
    ......
    .........
    focus.main_menu === true
    }
    @

    here is a pseudo code for what I'm trying to do

    @
    Keys.onPressed:{
    go to base state from state1
    state1.menu.item== false
    base.state.menu.itme== true
    }
    @

    I just really want to be able to control which item has the key nav. focus.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gennon
      wrote on last edited by
      #2

      Hi. try to use the KeyNavigation method.

      http://qt-project.org/doc/qt-4.8/qml-keynavigation.html

      @
      Item{
      id: item1

      KeyNavigation.down: item2
      

      }

      Item{
      id: item2
      KeyNavigation.up: item1
      }

      @

      if you need to force an item to get focus you should use forceActiveFocus().

      http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-item.html#forceActiveFocus-method

      /Gen

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved