press 'Tab' key, first time, navigate successfully between the four controls. but since the second time, button1 can't focus.
first time, navigation chain:
checkbox1 -> checkbox2 -> button1 -> button2
since the second time, navigation chain:
checkbox1 -> checkbox2 -> button2
why?
//////////////////////////////// code: // main.qml
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Item {
anchors.fill: parent
Column {
CheckBox {
id: checkbox1
text: "checkbox1"
focus: true
KeyNavigation.tab: checkbox2
}
CheckBox {
id: checkbox2
text: "checkbox2"
focus: true
KeyNavigation.tab: loadItem
}
Loader {
id: loadItem
width: 100
height: 40
source: "OtherItem.qml"
focus: true
KeyNavigation.tab: checkbox1
}
}
}
}
// OtherItem.qml
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
Item {
anchors.fill: parent
Row {
Button {
id: button1
text: "button1"
focus: true
KeyNavigation.tab: button2
Keys.onReturnPressed: {
console.log("button1 enter");
}
}
Button {
id: button2
text: "button2"
focus: true
Keys.onReturnPressed: {
console.log("button2 enter");
}
}
}
}