aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/accessibility/content/Checkbox.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/accessibility/content/Checkbox.qml')
-rw-r--r--examples/quick/accessibility/content/Checkbox.qml33
1 files changed, 25 insertions, 8 deletions
diff --git a/examples/quick/accessibility/content/Checkbox.qml b/examples/quick/accessibility/content/Checkbox.qml
index 273e38b239..c67d593f1d 100644
--- a/examples/quick/accessibility/content/Checkbox.qml
+++ b/examples/quick/accessibility/content/Checkbox.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
@@ -43,20 +43,37 @@
import QtQuick 2.0
-Rectangle {
+FocusScope {
id: checkbox
Accessible.role: Accessible.CheckBox
+ property string text: "CheckBox"
property bool checked // required variable
- width: 30
+ width: 100
height: 30
-
- Text {
- id: checkboxText
- text: parent.checked ? "on" : "off"
- anchors.centerIn: parent
+ Row {
+ spacing: 2
+ Rectangle {
+ width: 12
+ height: 12
+ border.width: checkbox.focus ? 2 : 1
+ border.color: "black"
+ Text {
+ id: checkboxText
+ text: checkbox.checked ? "x" : ""
+ anchors.centerIn: parent
+ }
+ }
+ Text {
+ text: checkbox.text
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: checkbox.checked = !checkbox.checked
}
+ Keys.onSpacePressed: checkbox.checked = !checkbox.checked
}