aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/qtquick1/text
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/qtquick1/text')
-rw-r--r--examples/declarative/qtquick1/text/fonts/availableFonts.qml57
-rw-r--r--examples/declarative/qtquick1/text/fonts/banner.qml61
-rw-r--r--examples/declarative/qtquick1/text/fonts/fonts.qml104
-rw-r--r--examples/declarative/qtquick1/text/fonts/fonts.qmlproject14
-rw-r--r--examples/declarative/qtquick1/text/fonts/fonts/tarzeau_ocr_a.ttfbin24544 -> 0 bytes
-rw-r--r--examples/declarative/qtquick1/text/fonts/hello.qml79
-rw-r--r--examples/declarative/qtquick1/text/text.qmlproject14
-rw-r--r--examples/declarative/qtquick1/text/textselection/pics/endHandle.pngbin185 -> 0 bytes
-rw-r--r--examples/declarative/qtquick1/text/textselection/pics/endHandle.sci5
-rw-r--r--examples/declarative/qtquick1/text/textselection/pics/startHandle.pngbin178 -> 0 bytes
-rw-r--r--examples/declarative/qtquick1/text/textselection/pics/startHandle.sci5
-rw-r--r--examples/declarative/qtquick1/text/textselection/textselection.qml289
-rw-r--r--examples/declarative/qtquick1/text/textselection/textselection.qmlproject16
13 files changed, 0 insertions, 644 deletions
diff --git a/examples/declarative/qtquick1/text/fonts/availableFonts.qml b/examples/declarative/qtquick1/text/fonts/availableFonts.qml
deleted file mode 100644
index 4a2c56e34e..0000000000
--- a/examples/declarative/qtquick1/text/fonts/availableFonts.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 1.0
-
-Rectangle {
- width: 480; height: 640; color: "steelblue"
-
- ListView {
- anchors.fill: parent; model: Qt.fontFamilies()
-
- delegate: Item {
- height: 40; width: ListView.view.width
- Text {
- anchors.centerIn: parent
- text: modelData; font.family: modelData; font.pixelSize: 24; color: "white"
- }
- }
- }
-}
diff --git a/examples/declarative/qtquick1/text/fonts/banner.qml b/examples/declarative/qtquick1/text/fonts/banner.qml
deleted file mode 100644
index a18c69bab0..0000000000
--- a/examples/declarative/qtquick1/text/fonts/banner.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 1.0
-
-Rectangle {
- id: screen
-
- property int pixelSize: screen.height * 1.25
- property color textColor: "lightsteelblue"
- property string text: "Hello world! "
-
- width: 640; height: 320
- color: "steelblue"
-
- Row {
- y: -screen.height / 4.5
-
- NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite }
- Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
- Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
- Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
- }
-}
diff --git a/examples/declarative/qtquick1/text/fonts/fonts.qml b/examples/declarative/qtquick1/text/fonts/fonts.qml
deleted file mode 100644
index a155f7abad..0000000000
--- a/examples/declarative/qtquick1/text/fonts/fonts.qml
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 1.0
-
-Rectangle {
- property string myText: "The quick brown fox jumps over the lazy dog."
-
- width: 800; height: 480
- color: "steelblue"
-
- FontLoader { id: fixedFont; name: "Courier" }
- FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" }
- FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
-
- Column {
- anchors { fill: parent; leftMargin: 10; rightMargin: 10 }
- spacing: 15
-
- Text {
- text: myText
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideRight
- font.family: "Times"; font.pointSize: 42
- }
- Text {
- text: myText
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideLeft
- font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase }
- }
- Text {
- text: myText
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideMiddle
- font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase }
- }
- Text {
- text: myText
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideRight
- font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps }
- }
- Text {
- text: myText
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideLeft
- font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize }
- }
- Text {
- text: {
- if (webFont.status == FontLoader.Ready) myText
- else if (webFont.status == FontLoader.Loading) "Loading..."
- else if (webFont.status == FontLoader.Error) "Error loading font"
- }
- color: "lightsteelblue"
- width: parent.width
- elide: Text.ElideMiddle
- font.family: webFont.name; font.pointSize: 42
- }
- }
-}
diff --git a/examples/declarative/qtquick1/text/fonts/fonts.qmlproject b/examples/declarative/qtquick1/text/fonts/fonts.qmlproject
deleted file mode 100644
index 2bb4016996..0000000000
--- a/examples/declarative/qtquick1/text/fonts/fonts.qmlproject
+++ /dev/null
@@ -1,14 +0,0 @@
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
-}
diff --git a/examples/declarative/qtquick1/text/fonts/fonts/tarzeau_ocr_a.ttf b/examples/declarative/qtquick1/text/fonts/fonts/tarzeau_ocr_a.ttf
deleted file mode 100644
index cf93f9651f..0000000000
--- a/examples/declarative/qtquick1/text/fonts/fonts/tarzeau_ocr_a.ttf
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/qtquick1/text/fonts/hello.qml b/examples/declarative/qtquick1/text/fonts/hello.qml
deleted file mode 100644
index 167b1e8f84..0000000000
--- a/examples/declarative/qtquick1/text/fonts/hello.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 1.0
-
-Rectangle {
- id: screen
-
- width: 800; height: 480
- color: "black"
-
- Item {
- id: container
- x: screen.width / 2; y: screen.height / 2
-
- Text {
- id: text
- anchors.centerIn: parent
- color: "white"
- text: "Hello world!"
- font.pixelSize: 60
- smooth: true
-
- SequentialAnimation on font.letterSpacing {
- loops: Animation.Infinite;
- NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 }
- ScriptAction {
- script: {
- container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
- container.x = (screen.width / 4) + (Math.random() * screen.width / 2)
- }
- }
- }
-
- SequentialAnimation on opacity {
- loops: Animation.Infinite;
- NumberAnimation { from: 1; to: 0; duration: 2600 }
- PauseAnimation { duration: 400 }
- }
- }
- }
-}
diff --git a/examples/declarative/qtquick1/text/text.qmlproject b/examples/declarative/qtquick1/text/text.qmlproject
deleted file mode 100644
index 2bb4016996..0000000000
--- a/examples/declarative/qtquick1/text/text.qmlproject
+++ /dev/null
@@ -1,14 +0,0 @@
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
-}
diff --git a/examples/declarative/qtquick1/text/textselection/pics/endHandle.png b/examples/declarative/qtquick1/text/textselection/pics/endHandle.png
deleted file mode 100644
index 1a4bc5d7a0..0000000000
--- a/examples/declarative/qtquick1/text/textselection/pics/endHandle.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/qtquick1/text/textselection/pics/endHandle.sci b/examples/declarative/qtquick1/text/textselection/pics/endHandle.sci
deleted file mode 100644
index 4f51f24278..0000000000
--- a/examples/declarative/qtquick1/text/textselection/pics/endHandle.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 0
-border.top: 6
-border.bottom: 6
-border.right: 6
-source: endHandle.png
diff --git a/examples/declarative/qtquick1/text/textselection/pics/startHandle.png b/examples/declarative/qtquick1/text/textselection/pics/startHandle.png
deleted file mode 100644
index deedcd5c91..0000000000
--- a/examples/declarative/qtquick1/text/textselection/pics/startHandle.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/qtquick1/text/textselection/pics/startHandle.sci b/examples/declarative/qtquick1/text/textselection/pics/startHandle.sci
deleted file mode 100644
index f9eae204c1..0000000000
--- a/examples/declarative/qtquick1/text/textselection/pics/startHandle.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 6
-border.top: 6
-border.bottom: 6
-border.right: 0
-source: startHandle.png
diff --git a/examples/declarative/qtquick1/text/textselection/textselection.qml b/examples/declarative/qtquick1/text/textselection/textselection.qml
deleted file mode 100644
index 43e9c2f806..0000000000
--- a/examples/declarative/qtquick1/text/textselection/textselection.qml
+++ /dev/null
@@ -1,289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 1.0
-
-Rectangle {
- id: editor
- color: "lightGrey"
- width: 640; height: 480
-
- Rectangle {
- color: "white"
- anchors.fill: parent
- anchors.margins: 20
-
- BorderImage {
- id: startHandle
- source: "pics/startHandle.sci"
- opacity: 0.0
- width: 10
- x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width
- y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY
- height: edit.positionToRectangle(edit.selectionStart).height
- }
-
- BorderImage {
- id: endHandle
- source: "pics/endHandle.sci"
- opacity: 0.0
- width: 10
- x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX
- y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY
- height: edit.positionToRectangle(edit.selectionEnd).height
- }
-
- Flickable {
- id: flick
-
- anchors.fill: parent
- contentWidth: edit.paintedWidth
- contentHeight: edit.paintedHeight
- interactive: true
- clip: true
-
- function ensureVisible(r) {
- if (contentX >= r.x)
- contentX = r.x;
- else if (contentX+width <= r.x+r.width)
- contentX = r.x+r.width-width;
- if (contentY >= r.y)
- contentY = r.y;
- else if (contentY+height <= r.y+r.height)
- contentY = r.y+r.height-height;
- }
-
- TextEdit {
- id: edit
- width: flick.width
- height: flick.height
- focus: true
- wrapMode: TextEdit.Wrap
-
- onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
-
- text: "<h1>Text Selection</h1>"
- +"<p>This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform."
- +"<p><b>Press-and-hold</b> to select a word, then drag the selection handles."
- +"<p><b>Drag outside the selection</b> to scroll the text."
- +"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection."
- +"<p>It's too whacky to let you paste if there is no current selection."
-
- MouseArea {
- property string drag: ""
- property int pressPos
-
- x: -startHandle.width
- y: 0
- width: parent.width+startHandle.width+endHandle.width
- height: parent.height
-
- onPressAndHold: {
- if (editor.state == "") {
- edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
- edit.selectWord();
- editor.state = "selection"
- }
- }
-
- onClicked: {
- if (editor.state == "") {
- edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
- if (!edit.focus)
- edit.focus = true;
- edit.openSoftwareInputPanel();
- }
- }
-
- function hitHandle(h,x,y) {
- return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height
- }
-
- onPressed: {
- if (editor.state == "selection") {
- if (hitHandle(startHandle,mouse.x+x,mouse.y+y)) {
- drag = "start"
- flick.interactive = false
- } else if (hitHandle(endHandle,mouse.x+x,mouse.y+y)) {
- drag = "end"
- flick.interactive = false
- } else {
- var pos = edit.positionAt(mouse.x+x,mouse.y+y);
- if (pos >= edit.selectionStart && pos <= edit.selectionEnd) {
- drag = "selection"
- flick.interactive = false
- } else {
- drag = ""
- flick.interactive = true
- }
- }
- }
- }
-
- onReleased: {
- if (editor.state == "selection") {
- if (drag == "selection") {
- editor.state = "menu"
- }
- drag = ""
- }
- flick.interactive = true
- }
-
- onPositionChanged: {
- if (editor.state == "selection" && drag != "") {
- if (drag == "start") {
- var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y);
- var e = edit.selectionEnd;
- if (e < pos)
- e = pos;
- edit.select(pos,e);
- } else if (drag == "end") {
- var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y);
- var s = edit.selectionStart;
- if (s > pos)
- s = pos;
- edit.select(s,pos);
- }
- }
- }
- }
- }
- }
-
- Item {
- id: menu
- opacity: 0.0
- width: 100
- height: 120
- anchors.centerIn: parent
-
- Rectangle {
- border.width: 1
- border.color: "darkBlue"
- radius: 15
- color: "#806080FF"
- anchors.fill: parent
- }
-
- Column {
- anchors.centerIn: parent
- spacing: 8
-
- Rectangle {
- border.width: 1
- border.color: "darkBlue"
- color: "#ff7090FF"
- width: 60
- height: 16
-
- Text { anchors.centerIn: parent; text: "Cut" }
-
- MouseArea {
- anchors.fill: parent
- onClicked: { edit.cut(); editor.state = "" }
- }
- }
-
- Rectangle {
- border.width: 1
- border.color: "darkBlue"
- color: "#ff7090FF"
- width: 60
- height: 16
-
- Text { anchors.centerIn: parent; text: "Copy" }
-
- MouseArea {
- anchors.fill: parent
- onClicked: { edit.copy(); editor.state = "selection" }
- }
- }
-
- Rectangle {
- border.width: 1
- border.color: "darkBlue"
- color: "#ff7090FF"
- width: 60
- height: 16
-
- Text { anchors.centerIn: parent; text: "Paste" }
-
- MouseArea {
- anchors.fill: parent
- onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" }
- }
- }
-
- Rectangle {
- border.width: 1
- border.color: "darkBlue"
- color: "#ff7090FF"
- width: 60
- height: 16
-
- Text { anchors.centerIn: parent; text: "Deselect" }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- edit.cursorPosition = edit.selectionEnd;
- edit.deselect();
- editor.state = ""
- }
- }
- }
- }
- }
- }
-
- states: [
- State {
- name: "selection"
- PropertyChanges { target: startHandle; opacity: 1.0 }
- PropertyChanges { target: endHandle; opacity: 1.0 }
- },
- State {
- name: "menu"
- PropertyChanges { target: startHandle; opacity: 0.5 }
- PropertyChanges { target: endHandle; opacity: 0.5 }
- PropertyChanges { target: menu; opacity: 1.0 }
- }
- ]
-}
diff --git a/examples/declarative/qtquick1/text/textselection/textselection.qmlproject b/examples/declarative/qtquick1/text/textselection/textselection.qmlproject
deleted file mode 100644
index ac8cfab8de..0000000000
--- a/examples/declarative/qtquick1/text/textselection/textselection.qmlproject
+++ /dev/null
@@ -1,16 +0,0 @@
-import QmlProject 1.1
-
-Project {
- mainFile: "textselection.qml"
-
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
-}