Home > Mobile >  How do you make input box loses focus QML?
How do you make input box loses focus QML?

Time:04-10


I only three controls interface: 1. The input box, 2. The Button, (3) radio Button
After I found gains focus when the input box, the cursor in the input box, and when I click on the button or radio button, at this time the cursor is still flashing in the input box,

The question I
1. Does this mean when you click on the Button or radio Button after the focus in the input box?
2. How to implement when clicking on the Button or radio Button to input box after losing focus?

My code is as follows:


The import QtQuick 2.12
The import QtQuick. Windows 2.12
The import QtQuick. Controls 2.12
The import QtQuick. Controls 1.4
The Window {
Visible: true
Width: 640
Height: 480
Title: qsTr (" Hello World ")
A Rectangle {
Width: 240
Height: 80
Border color: "# FFFF00
"Border. Width: 3
Anchors. CenterIn: parent
The radius: 5
({
Id: input
Anchors. The fill: parent
Anchors. Margins: 2
}
}

The Row {
Anchors. Left: the parent. Left
Anchors. Right: the parent. The right
Anchors. Bottom: the parent. The bottom
Height: 30
Spacing: 10
ExclusiveGroup {
Id: group
}
RadioButton {
Id: radio_1
ExclusiveGroup: group
Text: qsTr (" Base ")
}
RadioButton {
Id: radio_2
ExclusiveGroup: group
Text: qsTr (" Advanced ")
}
RadioButton {
Id: radio_3
ExclusiveGroup: group
Text: qsTr (" Advanced ")
}
}

The Button {
Id: BTN
Text: "OK"

OnClicked: {
The console. The log (input. Text)
The console. The log (BTN. Text)
}
}
}
  •  Tags:  
  • Qt
  • Related