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. Getting keyboard focus with TabView
Forum Updated to NodeBB v4.3 + New Features

Getting keyboard focus with TabView

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.2k 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.
  • B Offline
    B Offline
    bobbaluba
    wrote on last edited by
    #1

    I'm trying to get the keyboard focus inside a tab. What am I doing wrong?

    @import QtQuick 2.2
    import QtQuick.Controls 1.1

    ApplicationWindow {
    id: main
    visible: true
    width: 640
    height: 480
    TabView {
    id: tabView
    anchors.fill: parent
    focus: true //tabview inherits focusscope, so we should probably set focus to true
    Tab {
    //broken
    Rectangle{
    color:'red'
    focus: true;
    Timer { repeat:true; interval: 1000; running: true; onTriggered: {console.log("Focus: "+parent.focus+" activeFocus: "+parent.activeFocus);}}
    }
    }
    }
    //works!
    // Rectangle{
    // anchors.fill: parent
    // color:'red'
    // focus: true;
    // Timer { repeat:true; interval: 1000; running: true; onTriggered: {console.log("Focus: "+parent.focus+" activeFocus: "+parent.activeFocus);}}
    // }
    }@

    For me, this prints "Focus: true activeFocus: false" once a second, how do I get activeFocus to be true as well?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bobbaluba
      wrote on last edited by
      #2

      I managed to get activeFocus by using forceActiveFocus().

      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