aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-01-10 12:12:51 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-07 20:08:19 +0100
commit70966df1be02dd94ecf9a122ff9e4976245aeb92 (patch)
tree372db90105c34d0c2a72e029f4e087fdc93423b7 /examples
parent3f9b58c0890a4263730e2c06b46e7a69d4bfb62d (diff)
Improve accessibility action support for Qt Quick
Add interface_cast for the action interface. Implement actions for the following roles: Button : Press CheckBox, RadioButton : Press, Check, Uncheck Slider, Spinbox, Dial, ScrollBar : Increment, Decrement Change-Id: Ic8e0d17c709ba51655f3f4b699092baf603b6f18 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/accessibility/widgets/Checkbox.qml62
-rw-r--r--examples/declarative/accessibility/widgets/Slider.qml67
-rw-r--r--examples/quick/accessibility/accessibility.qml16
-rw-r--r--examples/quick/accessibility/content/Button.qml5
4 files changed, 147 insertions, 3 deletions
diff --git a/examples/declarative/accessibility/widgets/Checkbox.qml b/examples/declarative/accessibility/widgets/Checkbox.qml
new file mode 100644
index 0000000000..17eb733197
--- /dev/null
+++ b/examples/declarative/accessibility/widgets/Checkbox.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+
+
+Rectangle {
+ id: checkbox
+
+ Accessible.role: Accessible.CheckBox
+
+ property bool checked // required variable
+
+ width: 30
+ height: 30
+
+
+ Text {
+ id: checkboxText
+ text: parent.checked ? "on" : "off"
+ anchors.centerIn: parent
+ }
+}
diff --git a/examples/declarative/accessibility/widgets/Slider.qml b/examples/declarative/accessibility/widgets/Slider.qml
new file mode 100644
index 0000000000..32aa6a3a41
--- /dev/null
+++ b/examples/declarative/accessibility/widgets/Slider.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+
+// Minimal slider implementation
+Rectangle {
+ id: slider
+
+ property alias text : buttonText.text
+ Accessible.role: Accessible.Slider
+
+ property int value // required
+ property int minimumValue : 0 // optional (default INT_MIN)
+ property int maximumValue : 20 // optional (default INT_MAX)
+ property int stepSize : 1 // optional (default 1)
+
+ width: 30
+ height: 30
+
+
+ Text {
+ id: buttonText
+ text: parent.value
+ anchors.centerIn: parent
+ font.pixelSize: parent.height * .5
+ }
+}
diff --git a/examples/quick/accessibility/accessibility.qml b/examples/quick/accessibility/accessibility.qml
index 2804d2abc8..e987561bb1 100644
--- a/examples/quick/accessibility/accessibility.qml
+++ b/examples/quick/accessibility/accessibility.qml
@@ -59,12 +59,13 @@ Rectangle {
id: column
spacing: 6
anchors.fill: parent
+ anchors.margins: 10
width: parent.width
Row {
spacing: 6
width: column.width
- Button { width: 100; height: column.h + 20; text: "Send" }
- Button { width: 100; height: column.h + 20; text: "Discard" }
+ Button { width: 100; height: column.h + 20; text: "Send"; onClicked : { status.text = "Send" } }
+ Button { width: 100; height: column.h + 20; text: "Discard"; onClicked : { status.text = "Discard" } }
}
Row {
@@ -106,5 +107,16 @@ Rectangle {
wrapMode: TextEdit.WordWrap
}
}
+ Text {
+ id : status
+ width: column.width
+ }
+
+ Row {
+ spacing: 6
+ width: column.width
+ Checkbox { checked: false }
+ Slider { value: 10 }
+ }
}
}
diff --git a/examples/quick/accessibility/content/Button.qml b/examples/quick/accessibility/content/Button.qml
index 2c203abe11..3d5086f741 100644
--- a/examples/quick/accessibility/content/Button.qml
+++ b/examples/quick/accessibility/content/Button.qml
@@ -49,6 +49,9 @@ Rectangle {
Accessible.name: text
Accessible.description: "This button does " + text
Accessible.role: Accessible.Button
+ function accessiblePressAction() {
+ button.clicked()
+ }
signal clicked
@@ -74,7 +77,7 @@ Rectangle {
id: mouseArea
anchors.fill: parent
onClicked: {
- checked = !checked;
+ parent.clicked()
}
}
}