blob: 7f9e303dba20a12ce2cfb6f18e31c7fbe6287721 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
import QtQuick
Item {
Component.onCompleted: item.focus = true
width: 640
height: 480
Column {
anchors.top: parent.top
anchors.topMargin: 10
spacing: 10
objectName: "column"
focusPolicy: Qt.ClickFocus
Item {
id: item
implicitWidth: 100
implicitHeight: 20
objectName: "item"
focusPolicy: Qt.TabFocus
Rectangle {
id: rect
anchors.fill: parent
color: "yellow"
opacity: 0.5
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: function onClicked(mouseEvent) {
if (mouseEvent.button == Qt.RightButton)
rect.color = "pink"
}
}
}
Item {
id: customText
objectName: "customText"
implicitWidth: 100
implicitHeight: 50
TextInput {
anchors.fill: parent
objectName: "textInputChild"
text: parent.activeFocus ? "focus" : "no focus"
}
activeFocusOnTab: true
}
Item {
id: customItem
objectName: "customItem"
implicitWidth: 100
implicitHeight: 50
Rectangle {
anchors.fill: parent
color: parent.activeFocus ? "red" : "blue"
opacity: 0.3
}
focusPolicy: Qt.WheelFocus
}
Text {
id: hyperlink
objectName: "hyperlink"
color: "blue"
onLinkActivated: { text = "Clicked"; }
textFormat: Text.RichText
text: "<a href=\"http://qt-project.org\">Qt Project website</a>"
focusPolicy: Qt.StrongFocus
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.NoButton // Don't eat the mouse clicks
cursorShape: Qt.PointingHandCursor
// the acceptedButtons will take precedence
// and the click focus policy will be ignored
focusPolicy: Qt.ClickFocus
}
}
}
}
|