PDA

View Full Version : go focus to The Next Element in qml



ravandi
12th November 2015, 13:25
Like the following picture:
11512
By pressing the tab,focus Change.

anda_skoa
12th November 2015, 16:18
http://doc.qt.io/qt-5/qml-qtquick-keynavigation.html

Cheers,
_

ravandi
12th November 2015, 17:21
My problem is:
with press Button tab ,Focus doesn"t go to Next Element!

anda_skoa
12th November 2015, 19:21
Then you'll have to show the code that exhibits the problem.

Cheers,
_

ravandi
13th November 2015, 04:30
import QtQuick 2.0
import QtQuick.Controls 1.1

Rectangle {
id: root
color: "#ffffff"
width: 320
height: 320
border.width: 5
border.color: "#000000"

Rectangle {
id: mo
x: 100
y: 8
width: 110
height: 20
border.width: 1
border.color: "#000000"
radius: 10
focus: true
}

TextEdit {
id: textEdit1
x: 100
y: 8
width: 110
height: 20
text: ctrl.name
font.pixelSize: 12
clip:true
focus: true
}

Button {
id: button1
x: 130
y: 34
width: 50
height: 27
focus: true
text: qsTr("ارسال")
onClicked: {
ctrl.name = textEdit1.text
ctrl.hello()
}

}

Text {
id: text1
x: 100
y: 67
width: 110
height: 23
text: ctrl.message
font.pixelSize: 12
}
}

anda_skoa
13th November 2015, 09:04
The Rectangle doesn't need focus, it doesn't deal with keyboard input.

And your code snippet is missing the KeyNavigation entries.

Cheers,
_