From 6cd8b6830039aea7f748527882942752f900cefd Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 12 Aug 2013 17:53:40 +0200 Subject: Doc: Renamed accessibility example to "quick-accessibility". -Generated HTML file name conflicted with accessibility group. Task-number: QTBUG-32580 Change-Id: I5f5a4bb8134268c58105ea61d5ae3bbdd35c0d50 Reviewed-by: Martin Smith --- examples/quick/accessibility/accessibility.pro | 8 -- examples/quick/accessibility/accessibility.qml | 152 --------------------- .../quick/accessibility/accessibility.qmlproject | 16 --- examples/quick/accessibility/accessibility.qrc | 8 -- examples/quick/accessibility/content/Button.qml | 88 ------------ examples/quick/accessibility/content/Checkbox.qml | 82 ----------- examples/quick/accessibility/content/Slider.qml | 90 ------------ .../quick/accessibility/doc/src/accessibility.qdoc | 40 ------ examples/quick/accessibility/main.cpp | 41 ------ .../quick/quick-accessibility/accessibility.qml | 152 +++++++++++++++++++++ .../quick-accessibility/accessibility.qmlproject | 16 +++ .../quick/quick-accessibility/accessibility.qrc | 8 ++ .../quick/quick-accessibility/content/Button.qml | 88 ++++++++++++ .../quick/quick-accessibility/content/Checkbox.qml | 82 +++++++++++ .../quick/quick-accessibility/content/Slider.qml | 90 ++++++++++++ .../quick-accessibility/doc/src/accessibility.qdoc | 40 ++++++ examples/quick/quick-accessibility/main.cpp | 41 ++++++ .../quick-accessibility/quick-accessibility.pro | 8 ++ examples/quick/quick.pro | 2 +- 19 files changed, 526 insertions(+), 526 deletions(-) delete mode 100644 examples/quick/accessibility/accessibility.pro delete mode 100644 examples/quick/accessibility/accessibility.qml delete mode 100644 examples/quick/accessibility/accessibility.qmlproject delete mode 100644 examples/quick/accessibility/accessibility.qrc delete mode 100644 examples/quick/accessibility/content/Button.qml delete mode 100644 examples/quick/accessibility/content/Checkbox.qml delete mode 100644 examples/quick/accessibility/content/Slider.qml delete mode 100644 examples/quick/accessibility/doc/src/accessibility.qdoc delete mode 100644 examples/quick/accessibility/main.cpp create mode 100644 examples/quick/quick-accessibility/accessibility.qml create mode 100644 examples/quick/quick-accessibility/accessibility.qmlproject create mode 100644 examples/quick/quick-accessibility/accessibility.qrc create mode 100644 examples/quick/quick-accessibility/content/Button.qml create mode 100644 examples/quick/quick-accessibility/content/Checkbox.qml create mode 100644 examples/quick/quick-accessibility/content/Slider.qml create mode 100644 examples/quick/quick-accessibility/doc/src/accessibility.qdoc create mode 100644 examples/quick/quick-accessibility/main.cpp create mode 100644 examples/quick/quick-accessibility/quick-accessibility.pro (limited to 'examples/quick') diff --git a/examples/quick/accessibility/accessibility.pro b/examples/quick/accessibility/accessibility.pro deleted file mode 100644 index 3f4ea644ac..0000000000 --- a/examples/quick/accessibility/accessibility.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += accessibility.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/accessibility -INSTALLS += target diff --git a/examples/quick/accessibility/accessibility.qml b/examples/quick/accessibility/accessibility.qml deleted file mode 100644 index 6fb25e37d7..0000000000 --- a/examples/quick/accessibility/accessibility.qml +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Rectangle { - id: window - - width: 320; height: 480 - color: "white" - - Column { - id: column - spacing: 6 - anchors.fill: parent - anchors.margins: 10 - width: parent.width - - Row { - spacing: 6 - width: column.width - - Text { - id: subjectLabel - //! [text] - Accessible.role: Accessible.StaticText - Accessible.name: text - //! [text] - text: "Subject:" - y: 3 - } - - Rectangle { - id: subjectBorder - Accessible.role: Accessible.EditableText - Accessible.name: subjectEdit.text - border.width: 1 - border.color: "black" - height: subjectEdit.height + 6 - width: 240 - TextInput { - focus: true - y: 3 - x: 3 - width: parent.width - 6 - id: subjectEdit - text: "Vacation plans" - KeyNavigation.tab: textEdit - } - } - } - - Rectangle { - id: textBorder - Accessible.role: Accessible.EditableText - property alias text: textEdit.text - border.width: 1 - border.color: "black" - width: parent.width - 2 - height: 200 - - TextEdit { - id: textEdit - y: 3 - x: 3 - width: parent.width - 6 - height: parent.height - 6 - text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nBest wishes, your friend Luke" - wrapMode: TextEdit.WordWrap - KeyNavigation.tab: sendButton - KeyNavigation.priority: KeyNavigation.BeforeItem - } - } - - Text { - id : status - width: column.width - } - - Row { - spacing: 6 - Button { - id: sendButton - width: 100; height: 20 - text: "Send" - onClicked: { status.text = "Send" } - KeyNavigation.tab: discardButton - } - Button { id: discardButton - width: 100; height: 20 - text: "Discard" - onClicked: { status.text = "Discard" } - KeyNavigation.tab: checkBox - } - } - - Row { - spacing: 6 - - Checkbox { - id: checkBox - checked: false - KeyNavigation.tab: slider - } - - Slider { - id: slider - value: 10 - KeyNavigation.tab: subjectEdit - } - } - } -} diff --git a/examples/quick/accessibility/accessibility.qmlproject b/examples/quick/accessibility/accessibility.qmlproject deleted file mode 100644 index 04a3190914..0000000000 --- a/examples/quick/accessibility/accessibility.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "accessibility.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/accessibility/accessibility.qrc b/examples/quick/accessibility/accessibility.qrc deleted file mode 100644 index 462a9a590c..0000000000 --- a/examples/quick/accessibility/accessibility.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - accessibility.qml - content/Button.qml - content/Checkbox.qml - content/Slider.qml - - diff --git a/examples/quick/accessibility/content/Button.qml b/examples/quick/accessibility/content/Button.qml deleted file mode 100644 index 4034f074a9..0000000000 --- a/examples/quick/accessibility/content/Button.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: button - - property bool checked: false - property alias text : buttonText.text - //! [button] - Accessible.name: text - Accessible.description: "This button does " + text - Accessible.role: Accessible.Button - function accessiblePressAction() { - button.clicked() - } - //! [button] - - signal clicked - - width: buttonText.width + 20 - height: 30 - gradient: Gradient { - GradientStop { position: 0.0; color: "lightsteelblue" } - GradientStop { position: 1.0; - color: button.focus ? "red" : "blue" } - } - - radius: 5 - antialiasing: true - - Text { - id: buttonText - text: parent.description - anchors.centerIn: parent - font.pixelSize: parent.height * .5 - style: Text.Sunken - color: "white" - styleColor: "black" - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: parent.clicked() - } - - Keys.onSpacePressed: clicked() -} diff --git a/examples/quick/accessibility/content/Checkbox.qml b/examples/quick/accessibility/content/Checkbox.qml deleted file mode 100644 index c4b8e8e380..0000000000 --- a/examples/quick/accessibility/content/Checkbox.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -FocusScope { - id: checkbox - - Accessible.role: Accessible.CheckBox - - property string text: "CheckBox" - property bool checked // required variable - - width: 100 - height: 30 - - 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 -} diff --git a/examples/quick/accessibility/content/Slider.qml b/examples/quick/accessibility/content/Slider.qml deleted file mode 100644 index 1a71e515f6..0000000000 --- a/examples/quick/accessibility/content/Slider.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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: 5 // 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: 100 - height: 30 - border.color: "black" - border.width: 1 - - Rectangle { - id: indicator - x: 1 - y: 1 - height: parent.height - 2 - width: ((parent.width - 2) / maximumValue) * value - color: "lightgrey" - Behavior on width { - NumberAnimation { duration: 50 } - } - } - - Text { - id: buttonText - text: parent.value - anchors.centerIn: parent - font.pixelSize: parent.height * .5 - } - - MouseArea { - anchors.fill: parent - onClicked: { - var pos = mouse.x / slider.width * (maximumValue - minimumValue) + minimumValue - slider.value = pos - } - } - - Keys.onLeftPressed: value > minimumValue ? value = value - stepSize : minimumValue - Keys.onRightPressed: value < maximumValue ? value = value + stepSize : maximumValue -} diff --git a/examples/quick/accessibility/doc/src/accessibility.qdoc b/examples/quick/accessibility/doc/src/accessibility.qdoc deleted file mode 100644 index 0281ffff4e..0000000000 --- a/examples/quick/accessibility/doc/src/accessibility.qdoc +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \title Qt Quick Examples - Accessibility - \example accessibility - \brief This example has accessible buttons. - \ingroup qtquickexamples - - Types in this example are augmented with meta-data for accessiblity systems. - - For example, the button identifies itself and its functionality to the accessibility system: - \snippet accessibility/content/Button.qml button - - As do Text types inside the example: - \snippet accessibility/accessibility.qml text -*/ diff --git a/examples/quick/accessibility/main.cpp b/examples/quick/accessibility/main.cpp deleted file mode 100644 index aee428a1ab..0000000000 --- a/examples/quick/accessibility/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(accessibility/accessibility) diff --git a/examples/quick/quick-accessibility/accessibility.qml b/examples/quick/quick-accessibility/accessibility.qml new file mode 100644 index 0000000000..6fb25e37d7 --- /dev/null +++ b/examples/quick/quick-accessibility/accessibility.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "content" + +Rectangle { + id: window + + width: 320; height: 480 + color: "white" + + Column { + id: column + spacing: 6 + anchors.fill: parent + anchors.margins: 10 + width: parent.width + + Row { + spacing: 6 + width: column.width + + Text { + id: subjectLabel + //! [text] + Accessible.role: Accessible.StaticText + Accessible.name: text + //! [text] + text: "Subject:" + y: 3 + } + + Rectangle { + id: subjectBorder + Accessible.role: Accessible.EditableText + Accessible.name: subjectEdit.text + border.width: 1 + border.color: "black" + height: subjectEdit.height + 6 + width: 240 + TextInput { + focus: true + y: 3 + x: 3 + width: parent.width - 6 + id: subjectEdit + text: "Vacation plans" + KeyNavigation.tab: textEdit + } + } + } + + Rectangle { + id: textBorder + Accessible.role: Accessible.EditableText + property alias text: textEdit.text + border.width: 1 + border.color: "black" + width: parent.width - 2 + height: 200 + + TextEdit { + id: textEdit + y: 3 + x: 3 + width: parent.width - 6 + height: parent.height - 6 + text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nBest wishes, your friend Luke" + wrapMode: TextEdit.WordWrap + KeyNavigation.tab: sendButton + KeyNavigation.priority: KeyNavigation.BeforeItem + } + } + + Text { + id : status + width: column.width + } + + Row { + spacing: 6 + Button { + id: sendButton + width: 100; height: 20 + text: "Send" + onClicked: { status.text = "Send" } + KeyNavigation.tab: discardButton + } + Button { id: discardButton + width: 100; height: 20 + text: "Discard" + onClicked: { status.text = "Discard" } + KeyNavigation.tab: checkBox + } + } + + Row { + spacing: 6 + + Checkbox { + id: checkBox + checked: false + KeyNavigation.tab: slider + } + + Slider { + id: slider + value: 10 + KeyNavigation.tab: subjectEdit + } + } + } +} diff --git a/examples/quick/quick-accessibility/accessibility.qmlproject b/examples/quick/quick-accessibility/accessibility.qmlproject new file mode 100644 index 0000000000..04a3190914 --- /dev/null +++ b/examples/quick/quick-accessibility/accessibility.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "accessibility.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/quick-accessibility/accessibility.qrc b/examples/quick/quick-accessibility/accessibility.qrc new file mode 100644 index 0000000000..462a9a590c --- /dev/null +++ b/examples/quick/quick-accessibility/accessibility.qrc @@ -0,0 +1,8 @@ + + + accessibility.qml + content/Button.qml + content/Checkbox.qml + content/Slider.qml + + diff --git a/examples/quick/quick-accessibility/content/Button.qml b/examples/quick/quick-accessibility/content/Button.qml new file mode 100644 index 0000000000..4034f074a9 --- /dev/null +++ b/examples/quick/quick-accessibility/content/Button.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: button + + property bool checked: false + property alias text : buttonText.text + //! [button] + Accessible.name: text + Accessible.description: "This button does " + text + Accessible.role: Accessible.Button + function accessiblePressAction() { + button.clicked() + } + //! [button] + + signal clicked + + width: buttonText.width + 20 + height: 30 + gradient: Gradient { + GradientStop { position: 0.0; color: "lightsteelblue" } + GradientStop { position: 1.0; + color: button.focus ? "red" : "blue" } + } + + radius: 5 + antialiasing: true + + Text { + id: buttonText + text: parent.description + anchors.centerIn: parent + font.pixelSize: parent.height * .5 + style: Text.Sunken + color: "white" + styleColor: "black" + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: parent.clicked() + } + + Keys.onSpacePressed: clicked() +} diff --git a/examples/quick/quick-accessibility/content/Checkbox.qml b/examples/quick/quick-accessibility/content/Checkbox.qml new file mode 100644 index 0000000000..c4b8e8e380 --- /dev/null +++ b/examples/quick/quick-accessibility/content/Checkbox.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +FocusScope { + id: checkbox + + Accessible.role: Accessible.CheckBox + + property string text: "CheckBox" + property bool checked // required variable + + width: 100 + height: 30 + + 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 +} diff --git a/examples/quick/quick-accessibility/content/Slider.qml b/examples/quick/quick-accessibility/content/Slider.qml new file mode 100644 index 0000000000..1a71e515f6 --- /dev/null +++ b/examples/quick/quick-accessibility/content/Slider.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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: 5 // 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: 100 + height: 30 + border.color: "black" + border.width: 1 + + Rectangle { + id: indicator + x: 1 + y: 1 + height: parent.height - 2 + width: ((parent.width - 2) / maximumValue) * value + color: "lightgrey" + Behavior on width { + NumberAnimation { duration: 50 } + } + } + + Text { + id: buttonText + text: parent.value + anchors.centerIn: parent + font.pixelSize: parent.height * .5 + } + + MouseArea { + anchors.fill: parent + onClicked: { + var pos = mouse.x / slider.width * (maximumValue - minimumValue) + minimumValue + slider.value = pos + } + } + + Keys.onLeftPressed: value > minimumValue ? value = value - stepSize : minimumValue + Keys.onRightPressed: value < maximumValue ? value = value + stepSize : maximumValue +} diff --git a/examples/quick/quick-accessibility/doc/src/accessibility.qdoc b/examples/quick/quick-accessibility/doc/src/accessibility.qdoc new file mode 100644 index 0000000000..2a2af1f159 --- /dev/null +++ b/examples/quick/quick-accessibility/doc/src/accessibility.qdoc @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Examples - Accessibility + \example quick-accessibility + \brief This example has accessible buttons. + \ingroup qtquickexamples + + Types in this example are augmented with meta-data for accessiblity systems. + + For example, the button identifies itself and its functionality to the accessibility system: + \snippet accessibility/content/Button.qml button + + As do Text types inside the example: + \snippet accessibility/accessibility.qml text +*/ diff --git a/examples/quick/quick-accessibility/main.cpp b/examples/quick/quick-accessibility/main.cpp new file mode 100644 index 0000000000..aee428a1ab --- /dev/null +++ b/examples/quick/quick-accessibility/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(accessibility/accessibility) diff --git a/examples/quick/quick-accessibility/quick-accessibility.pro b/examples/quick/quick-accessibility/quick-accessibility.pro new file mode 100644 index 0000000000..70cf34b54c --- /dev/null +++ b/examples/quick/quick-accessibility/quick-accessibility.pro @@ -0,0 +1,8 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += accessibility.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/quick-accessibility +INSTALLS += target diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index 311e264af1..e4c00fffa1 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = accessibility \ +SUBDIRS = quick-accessibility \ animation \ draganddrop \ canvas \ -- cgit v1.2.3