-
Notifications
You must be signed in to change notification settings - Fork 369
/
Copy pathmain.qml
56 lines (49 loc) · 1.35 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import Component 1.0
Window {
width: 640
height: 480
visible: true
title: qsTr("GongJianBo 1992")
Shortcut{
sequence: "space"
onActivated: {
console.log("shortcut active space")
}
}
Row{
spacing: 10
Button{
focus: true
text: "a"
onClicked: console.log("click",text)
onPressed: console.log("press",text)
//测试自定义Keys
//KeysFilter.enabled: false
KeysFilter.filterKeys: [Qt.Key_Space]
//KeysFilter.acceptShortcut: false
//测试Qt的Keys
//在5.12 5.13里accepted后组件只过滤了press,click还是会触发
/*Keys.onSpacePressed: {
console.log("key space")
event.accepted=false;
}
Keys.onShortcutOverride: {
console.log("key shortcut")
event.accepted=false;
}*/
}
Button{
text: "b"
onClicked: console.log("click",text)
onPressed: console.log("press",text)
}
Button{
text: "c"
onClicked: console.log("click",text)
onPressed: console.log("press",text)
}
}
}