Ich verstehe nicht, warum es nicht ordnungsgemäß funktioniert. Ich möchte TextEdit Fokus auf True setzen, wenn das Fenster herausspringt. TextEdit kann Schlüsselereignisse nur empfangen, nachdem ein Klick auf seinen Bereich ausgeführt wurde.Kann Fokus in TextEdit innerhalb eines StackView-Elements nicht abrufen
main.qml
ApplicationWindow {
id:aplWin
visible: true
minimumWidth: 1280
minimumHeight: 1024
StackView {
id: stackView
anchors.fill: parent
initialItem: SignInWin {}
}
}
SignInWin.qml
Page {
id: root
width: parent.width + 500
height: parent.height
Rectangle {
border.color: "black"
y: 200
width: 50
height: 20
z: 1
TextEdit {
anchors.fill: parent
color: "black"
focus: true
}
}
}
Versuchen Sie 'forceActiveFocus()' wenn 'Component.onComplete' – derM