aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/inputmethods/inputmethods.qmlproject16
-rw-r--r--examples/declarative/inputmethods/spellcheck/Key.qml85
-rw-r--r--examples/declarative/inputmethods/spellcheck/Keyboard.qml141
-rw-r--r--examples/declarative/inputmethods/spellcheck/WordSuggestions.qml100
-rw-r--r--examples/declarative/inputmethods/spellcheck/spellcheck.qml137
5 files changed, 0 insertions, 479 deletions
diff --git a/examples/declarative/inputmethods/inputmethods.qmlproject b/examples/declarative/inputmethods/inputmethods.qmlproject
deleted file mode 100644
index d4909f8685..0000000000
--- a/examples/declarative/inputmethods/inputmethods.qmlproject
+++ /dev/null
@@ -1,16 +0,0 @@
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
- /* List of plugin directories passed to QML runtime */
- // importPaths: [ " ../exampleplugin " ]
-}
diff --git a/examples/declarative/inputmethods/spellcheck/Key.qml b/examples/declarative/inputmethods/spellcheck/Key.qml
deleted file mode 100644
index c95a3f0b2c..0000000000
--- a/examples/declarative/inputmethods/spellcheck/Key.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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 Nokia Corporation 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- property string text
- property string displayText
- property alias font: keyText.font
- property int key: 0
-
- id: root
- radius: 2
-
- width: 28
- height: 28
-
- gradient: Gradient {
- GradientStop { position: 0.0; color: "darkgrey" }
- GradientStop { position: 1.0; color: "grey" }
- }
-
- Text {
- id: keyText
-
- anchors.fill: parent
-
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
-
- font.pixelSize: 18
- font.capitalization: keyboard.shift && displayText == "" ? Font.AllUppercase : Font.MixedCase
-
- text: root.displayText != "" ? root.displayText : root.text
-
- style: !mouseArea.pressed ? Text.Raised : Text.Normal
- color: "white"
- styleColor: "grey"
- }
-
- MouseArea {
- id: mouseArea
-
- anchors.fill: parent
- onPressed: keyboard.keyPress(key, text)
- onReleased: keyboard.keyRelease(key, text)
- }
-}
diff --git a/examples/declarative/inputmethods/spellcheck/Keyboard.qml b/examples/declarative/inputmethods/spellcheck/Keyboard.qml
deleted file mode 100644
index 533762e7ba..0000000000
--- a/examples/declarative/inputmethods/spellcheck/Keyboard.qml
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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 Nokia Corporation 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.inputcontext 1.0 as InputContext
-
-
-Rectangle {
- id: keyboard
-
- radius: 5
- height: 122
- width: 324
-
- property bool shift: false
-
- gradient: Gradient {
- GradientStop { position: 0.0; color: "lightgrey" }
- GradientStop { position: 1.0; color: "white" }
- }
-
- Column {
- anchors.left: parent.left; anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
-
- spacing: 2
-
- Row {
- spacing: 2
- anchors.horizontalCenter: parent.horizontalCenter
-
- Key { key: Qt.Key_Q; text: "q"; }
- Key { key: Qt.Key_W; text: "w"; }
- Key { key: Qt.Key_E; text: "e"; }
- Key { key: Qt.Key_R; text: "r"; }
- Key { key: Qt.Key_T; text: "t"; }
- Key { key: Qt.Key_Y; text: "y"; }
- Key { key: Qt.Key_U; text: "u"; }
- Key { key: Qt.Key_I; text: "i"; }
- Key { key: Qt.Key_O; text: "o"; }
- Key { key: Qt.Key_P; text: "p"; }
- }
- Row {
- spacing: 2
- anchors.horizontalCenter: parent.horizontalCenter
-
- Key { key: Qt.Key_A; text: "a"; }
- Key { key: Qt.Key_S; text: "s"; }
- Key { key: Qt.Key_D; text: "d"; }
- Key { key: Qt.Key_F; text: "f"; }
- Key { key: Qt.Key_G; text: "g"; }
- Key { key: Qt.Key_H; text: "h"; }
- Key { key: Qt.Key_J; text: "j"; }
- Key { key: Qt.Key_K; text: "k"; }
- Key { key: Qt.Key_L; text: "l"; }
- }
- Row {
- spacing: 2
- anchors.horizontalCenter: parent.horizontalCenter
-
- Key { key: Qt.Key_Shift; displayText: "shift"; width: 50 }
- Key { key: Qt.Key_Z; text: "z"; }
- Key { key: Qt.Key_X; text: "x"; }
- Key { key: Qt.Key_C; text: "c"; }
- Key { key: Qt.Key_V; text: "v"; }
- Key { key: Qt.Key_B; text: "b"; }
- Key { key: Qt.Key_N; text: "n"; }
- Key { key: Qt.Key_M; text: "m"; }
- Key { key: Qt.Key_Comma; text: ","; }
- Key { key: Qt.Key_Period; text: "."; }
- }
-
- Row {
- spacing: 2
- anchors.horizontalCenter: parent.horizontalCenter
-
- Key { key: Qt.Key_Enter; text: "\n"; displayText: "enter"; width: 90 }
- Key { key: Qt.Key_Space; text: " "; displayText: "space"; width: 138}
- Key { key: Qt.Key_Backspace; displayText: "backspace"; width: 90 }
- }
- }
-
- function keyPress(key, text)
- {
- if (key == Qt.Key_Shift)
- keyboard.shift = !keyboard.shift
- else if (keyboard.shift)
- InputContext.sendKeyPress(key, text.toUpperCase(), Qt.ShiftModifier)
- else
- InputContext.sendKeyPress(key, text)
- }
-
- function keyRelease(key, text)
- {
- if (key != Qt.Key_Shift) {
- if (keyboard.shift) {
- InputContext.sendKeyRelease(key, text.toUpperCase(), Qt.ShiftModifier)
- keyboard.shift = false
- } else {
- InputContext.sendKeyRelease(key, text)
- }
- }
- }
-}
diff --git a/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml b/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml
deleted file mode 100644
index 5c4e9cb4a2..0000000000
--- a/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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 Nokia Corporation 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.inputcontext 1.0 as InputContext
-
-ListView {
- property int globalX: InputContext.microFocus.x + ((InputContext.microFocus.width - width) / 2)
- property int globalY: InputContext.microFocus.y + InputContext.microFocus.height
-
- x: parent.mapToItem(null, globalX, globalY).x
- y: parent.mapToItem(null, globalX, globalY).y
-
- visible: suggestionModel.count > 0
-
- width: 200
- height: 70
-
- InputContext.KeyFilter {
- onPressed: event.accepted = filterKeyPress(event.key, event.text)
- }
-
- InputContext.MouseHandler {
- onPressed: {
- if (cursor < 0 || cursor >= InputContext.preeditText.length)
- InputContext.commit()
- }
- }
-
- model: XmlListModel {
- id: suggestionModel
-
- query: "/query/results/s:suggestion"
- namespaceDeclarations: "declare namespace s=\"http://www.inktomi.com/\";"
- source: InputContext.preeditText.length > 4 ? "http://query.yahooapis.com/v1/public/yql?q=select * from search.spelling where query=\"" + InputContext.preeditText + "\"" : ""
-
- XmlRole { name: "suggestion"; query: "string()" }
- }
-
- delegate: Rectangle {
- radius: 2
- color: "lightsteelblue"
-
- anchors.horizontalCenter: parent.horizontalCenter
-
- width: suggestionText.implicitWidth + 2
- height: suggestionText.implicitHeight + 2
-
- Text {
- id: suggestionText
-
- font: InputContext.font
- text: suggestion
-
- anchors.fill: parent
- anchors.margins: 1
- }
- MouseArea {
- anchors.fill: parent
- onClicked: InputContext.commit(suggestion)
- }
- }
-}
diff --git a/examples/declarative/inputmethods/spellcheck/spellcheck.qml b/examples/declarative/inputmethods/spellcheck/spellcheck.qml
deleted file mode 100644
index 57e81451a6..0000000000
--- a/examples/declarative/inputmethods/spellcheck/spellcheck.qml
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** 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 Nokia Corporation 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.inputcontext 1.0 as InputContext
-
-Item {
- width: 360
- height: 240
-
- function filterKeyPress(key, text)
- {
- switch (key) {
- case Qt.Key_Enter:
- case Qt.Key_Return:
- case Qt.Key_Space:
- case Qt.Key_Tab:
- if (InputContext.preeditText != "")
- InputContext.commit();
- break;
- case Qt.Key_Backspace:
- if (InputContext.preeditText != "") {
- InputContext.preeditText = InputContext.preeditText.substr(0, InputContext.preeditText.length - 1);
- return true;
- }
- break;
- default:
- if (text != "") {
- InputContext.preeditText += text
- return true;
- } else if (InputContext.preeditText != "") {
- InputContext.commit();
- }
- break;
- }
- return false;
- }
-
- Rectangle {
- anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right;
- anchors.bottom: keyboard.top
- anchors.margins: 2
-
- border.width: 1
- radius: 2
-
- TextEdit {
- id: textEdit
-
- wrapMode: TextEdit.WordWrap
-
- anchors.fill: parent
- anchors.margins: 2
- }
-
- MouseArea {
- anchors.fill: textEdit
-
- onPressed: {
- mouse.accepted = false
- var position = textEdit.positionAt(mouse.x, mouse.y);
- if (position != textEdit.cursorPosition) {
- InputContext.commit()
- textEdit.cursorPosition = textEdit.positionAt(mouse.x, mouse.y)
- textEdit.selectWord()
- var word = textEdit.selectedText
- if (word != "") {
- InputContext.commit("");
- InputContext.preeditText = word;
- }
- }
- }
- }
- }
-
- WordSuggestions {}
-
- Keyboard {
- id: keyboard
- anchors.horizontalCenter: parent.horizontalCenter
-
- y: parent.height
-
- states: [
- State {
- name: "visible"
- PropertyChanges { target: keyboard; y: parent.height - height }
- when: InputContext.softwareInputPanelVisible
- },
- State {
- name: "hidden"
- PropertyChanges { target: keyboard; y: parent.height }
- when: !InputContext.softwareInputPanelVisible
- }
- ]
- transitions: Transition {
- NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad; duration: 100 }
- }
- }
-}