Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Getting keyboard focus with TabView

$
0
0
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?

Viewing all articles
Browse latest Browse all 4972

Trending Articles