diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/draganddrop/dragtarget.qmlproject (renamed from examples/declarative/dragtarget/dragtarget.qmlproject) | 0 | ||||
-rw-r--r-- | examples/declarative/draganddrop/tiles/DragTile.qml (renamed from examples/declarative/dragtarget/tiles/DragTile.qml) | 78 | ||||
-rw-r--r-- | examples/declarative/draganddrop/tiles/DropTile.qml (renamed from examples/declarative/dragtarget/tiles/DropTile.qml) | 34 | ||||
-rw-r--r-- | examples/declarative/draganddrop/tiles/tiles.qml (renamed from examples/declarative/dragtarget/tiles/tiles.qml) | 30 | ||||
-rw-r--r-- | examples/declarative/draganddrop/views/gridview.qml | 117 | ||||
-rw-r--r-- | examples/declarative/dragtarget/lists/listmodel.qml | 296 | ||||
-rw-r--r-- | examples/declarative/dragtarget/lists/lists.qmlproject | 16 | ||||
-rw-r--r-- | examples/declarative/dragtarget/text/dragtext.qml | 182 | ||||
-rw-r--r-- | examples/declarative/dragtarget/text/text.qmlproject | 16 | ||||
-rw-r--r-- | examples/declarative/modelviews/visualdatamodel/dragselection.qml | 4 |
10 files changed, 177 insertions, 596 deletions
diff --git a/examples/declarative/dragtarget/dragtarget.qmlproject b/examples/declarative/draganddrop/dragtarget.qmlproject index d4909f8685..d4909f8685 100644 --- a/examples/declarative/dragtarget/dragtarget.qmlproject +++ b/examples/declarative/draganddrop/dragtarget.qmlproject diff --git a/examples/declarative/dragtarget/tiles/DragTile.qml b/examples/declarative/draganddrop/tiles/DragTile.qml index f1bd79314a..d7bc920735 100644 --- a/examples/declarative/dragtarget/tiles/DragTile.qml +++ b/examples/declarative/draganddrop/tiles/DragTile.qml @@ -40,60 +40,50 @@ import QtQuick 2.0 -Rectangle { - id: dragRectangle +Item { + id: root + property string colorKey - property Item dropTarget + width: 100; height: 100 - property string colorKey + MouseArea { + id: mouseArea - color: colorKey + width: 100; height: 100 + anchors.centerIn: parent - width: 100; height: 100 + drag.target: tile - Text { - anchors.fill: parent - color: "white" - font.pixelSize: 90 - text: modelData + 1 - horizontalAlignment:Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + onReleased: parent = tile.Drag.target !== null ? tile.Drag.target : root - MouseArea { - id: draggable + Rectangle { + id: tile - anchors.fill: parent + width: 100; height: 100 - drag.target: parent - drag.keys: [ colorKey ] + anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter + color: colorKey - drag.onDropped: dropTarget = dropItem + Drag.keys: [ colorKey ] + Drag.active: mouseArea.drag.active + Drag.hotSpot.x: 50 + Drag.hotSpot.y: 50 - states: [ - State { - when: dragRectangle.dropTarget != undefined && !draggable.drag.active - ParentChange { - target: dragRectangle - parent: dropTarget - x: 0 - y: 0 - } - }, - State { - when: dragRectangle.dropTarget != undefined && draggable.drag.active - ParentChange { - target: dragRectangle - parent: dropTarget - } - }, - State { - when: !draggable.drag.active - AnchorChanges { - target: dragRectangle - anchors.horizontalCenter: parent.horizontalCenter - } + Text { + anchors.fill: parent + color: "white" + font.pixelSize: 90 + text: modelData + 1 + horizontalAlignment:Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } - ] + + states: State { + when: mouseArea.drag.active + ParentChange { target: tile; parent: root } + AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined } + } + } } } + diff --git a/examples/declarative/dragtarget/tiles/DropTile.qml b/examples/declarative/draganddrop/tiles/DropTile.qml index 80aa81f671..492706439a 100644 --- a/examples/declarative/dragtarget/tiles/DropTile.qml +++ b/examples/declarative/draganddrop/tiles/DropTile.qml @@ -40,31 +40,29 @@ import QtQuick 2.0 -Rectangle { - id: dropRectangle +DropArea { + id: dragTarget property string colorKey - - color: colorKey + property alias dropProxy: dragTarget width: 100; height: 100 + keys: [ colorKey ] - DragTarget { - id: dragTarget + Rectangle { + id: dropRectangle anchors.fill: parent + color: colorKey - keys: [ colorKey ] - dropItem: dropRectangle - } - - states: [ - State { - when: dragTarget.containsDrag - PropertyChanges { - target: dropRectangle - color: "grey" + states: [ + State { + when: dragTarget.containsDrag + PropertyChanges { + target: dropRectangle + color: "grey" + } } - } - ] + ] + } } diff --git a/examples/declarative/dragtarget/tiles/tiles.qml b/examples/declarative/draganddrop/tiles/tiles.qml index 1f783e3322..17dcd3b547 100644 --- a/examples/declarative/dragtarget/tiles/tiles.qml +++ b/examples/declarative/draganddrop/tiles/tiles.qml @@ -48,12 +48,6 @@ Rectangle { color: "black" - DragTarget { - id: resetTarget - - anchors.fill: parent - } - Grid { id: redDestination @@ -61,22 +55,16 @@ Rectangle { anchors.margins: 5 width: 300 height: 300 - opacity: 0.5 - columns: 3 Repeater { - model: 9 - delegate: DropTile { - colorKey: "red" - } + model: 9; + delegate: DropTile { colorKey: "red" } } } Grid { - id: blueDestination - anchors.right: blueSource.left; anchors.bottom: parent.bottom; anchors.margins: 5 width: 300 @@ -88,9 +76,7 @@ Rectangle { Repeater { model: 9 - delegate: DropTile { - colorKey: "blue" - } + delegate: DropTile { colorKey: "blue" } } } @@ -100,12 +86,11 @@ Rectangle { anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.margins: 5 width: 100 + spacing: -60 Repeater { model: 9 - delegate: DragTile { - colorKey: "red" - } + delegate: DragTile { colorKey: "red" } } } Column { @@ -114,12 +99,11 @@ Rectangle { anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.margins: 5 width: 100 + spacing: -60 Repeater { model: 9 - delegate: DragTile { - colorKey: "blue" - } + delegate: DragTile { colorKey: "blue" } } } } diff --git a/examples/declarative/draganddrop/views/gridview.qml b/examples/declarative/draganddrop/views/gridview.qml new file mode 100644 index 0000000000..f16a79c9dc --- /dev/null +++ b/examples/declarative/draganddrop/views/gridview.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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 + +GridView { + id: root + width: 360; height: 360 + cellWidth: 90; cellHeight: 90 + + model: VisualDataModel { + id: visualModel + model: ListModel { + id: colorModel + ListElement { color: "blue" } + ListElement { color: "green" } + ListElement { color: "red" } + ListElement { color: "yellow" } + ListElement { color: "orange" } + ListElement { color: "purple" } + ListElement { color: "cyan" } + ListElement { color: "magenta" } + ListElement { color: "chartreuse" } + ListElement { color: "aquamarine" } + ListElement { color: "indigo" } + ListElement { color: "black" } + ListElement { color: "chartreuse" } + ListElement { color: "violet" } + ListElement { color: "grey" } + ListElement { color: "springgreen" } + } + + delegate: MouseArea { + id: delegateRoot + + property int visualIndex: VisualDataModel.itemsIndex + + width: 90; height: 90 + drag.target: icon + + Rectangle { + id: icon + width: 80; height: 80 + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter + } + color: model.color + radius: 3 + + Drag.active: delegateRoot.pressed + Drag.source: delegateRoot + Drag.hotSpot.x: 40 + Drag.hotSpot.y: 40 + + states: [ + State { + when: icon.Drag.active + ParentChange { + target: icon + parent: root + } + + AnchorChanges { + target: icon; + anchors.horizontalCenter: undefined; + anchors.verticalCenter: undefined + } + } + ] + } + + DropArea { + anchors { fill: parent; margins: 15 } + + onEntered: visualModel.items.move(drag.source.visualIndex, delegateRoot.visualIndex) + } + } + } +} diff --git a/examples/declarative/dragtarget/lists/listmodel.qml b/examples/declarative/dragtarget/lists/listmodel.qml deleted file mode 100644 index f153087e7b..0000000000 --- a/examples/declarative/dragtarget/lists/listmodel.qml +++ /dev/null @@ -1,296 +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 { - id: root - color: "grey" - - width: 720 - height: 380 - - Component { - id: draggedText - Text { - x: rootTarget.dragX - 10 - y: rootTarget.dragY - 10 - width: 20 - height: 20 - - text: rootTarget.dragData.display - font.pixelSize: 18 - } - } - - DragTarget { - id: rootTarget - - anchors.fill: parent - } - - Loader { - anchors.fill: parent - sourceComponent: rootTarget.containsDrag ? draggedText : undefined - } - - GridView { - id: gridView - - width: 240 - height: 360 - - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - anchors.margins: 10 - - cellWidth: 60 - cellHeight: 60 - - model: ListModel { - id: gridModel - - ListElement { display: "1" } - ListElement { display: "2" } - ListElement { display: "3" } - ListElement { display: "4" } - ListElement { display: "5" } - ListElement { display: "6" } - ListElement { display: "7" } - ListElement { display: "8" } - ListElement { display: "9" } - ListElement { display: "10" } - ListElement { display: "11" } - ListElement { display: "12" } - ListElement { display: "13" } - ListElement { display: "14" } - ListElement { display: "15" } - ListElement { display: "16" } - ListElement { display: "17" } - ListElement { display: "18" } - ListElement { display: "19" } - ListElement { display: "20" } - ListElement { display: "21" } - ListElement { display: "22" } - ListElement { display: "23" } - ListElement { display: "24" } - } - - delegate: Rectangle { - id: root - - width: 60 - height: 60 - - color: "black" - - Text { - anchors.fill: parent - color: draggable.drag.active ? "gold" : "white" - text: display - font.pixelSize: 16 - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - MouseArea { - id: draggable - - property int initialIndex - - width: 60 - height: 60 - - drag.data: model - drag.keys: ["grid"] - drag.target: draggable - - states: State { - when: !draggable.drag.active - PropertyChanges { target: draggable; x: 0; y: 0 } - } - } - } - - DragTarget { - anchors.fill: parent - - keys: [ "grid" ] - onPositionChanged: { - var index = gridView.indexAt(drag.x, drag.y) - if (index != -1) - gridModel.move(drag.data.index, index, 1) - } - } - - DragTarget { - property int dragIndex - anchors.fill: parent - - keys: [ "list" ] - onEntered: { - dragIndex = gridView.indexAt(drag.x, drag.y) - if (dragIndex != -1) { - gridModel.insert(dragIndex, { "display": drag.data.display }) - } else { - event.accepted = false - } - } - onPositionChanged: { - var index = gridView.indexAt(drag.x, drag.y); - if (index != -1) { - gridModel.move(dragIndex, index, 1) - dragIndex = index - } - } - onExited: gridModel.remove(dragIndex, 1) - } - } - - ListView { - id: listView - - width: 240 - height: 360 - - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: 10 - - model: ListModel { - id: listModel - - ListElement { display: "a" } - ListElement { display: "b" } - ListElement { display: "c" } - ListElement { display: "d"} - ListElement { display: "e" } - ListElement { display: "f" } - ListElement { display: "g" } - ListElement { display: "h" } - ListElement { display: "i" } - ListElement { display: "j" } - ListElement { display: "k" } - ListElement { display: "l" } - ListElement { display: "m" } - ListElement { display: "n" } - ListElement { display: "o" } - ListElement { display: "p" } - ListElement { display: "q" } - ListElement { display: "r" } - ListElement { display: "s" } - ListElement { display: "t" } - ListElement { display: "u" } - ListElement { display: "v" } - ListElement { display: "w" } - ListElement { display: "x" } - } - - delegate: Rectangle { - id: root - - width: 240 - height: 15 - - color: "black" - - Text { - anchors.fill: parent - color: draggable.drag.active ? "gold" : "white" - text: display - font.pixelSize: 12 - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - MouseArea { - id: draggable - - width: 240 - height: 15 - - drag.data: model - drag.keys: ["list"] - drag.target: draggable - - states: State { - when: !draggable.drag.active - PropertyChanges { target: draggable; x: 0; y: 0 } - } - } - } - - DragTarget { - anchors.fill: parent - - keys: [ "list" ] - onPositionChanged: { - var index = listView.indexAt(drag.x, drag.y) - if (index != -1) - listModel.move(drag.data.index, index, 1) - } - } - - DragTarget { - property int dragIndex - anchors.fill: parent - - keys: [ "grid" ] - - onEntered: { - dragIndex = listView.indexAt(drag.x, drag.y) - if (dragIndex != -1) { - listModel.insert(dragIndex, { "display": drag.data.display }) - } else { - event.accepted = false - } - } - onPositionChanged: { - var index = listView.indexAt(drag.x, drag.y); - if (index != -1) { - listModel.move(dragIndex, index, 1) - dragIndex = index - } - } - onExited: listModel.remove(dragIndex, 1) - } - } -} diff --git a/examples/declarative/dragtarget/lists/lists.qmlproject b/examples/declarative/dragtarget/lists/lists.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/examples/declarative/dragtarget/lists/lists.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/dragtarget/text/dragtext.qml b/examples/declarative/dragtarget/text/dragtext.qml deleted file mode 100644 index 49858d1fc4..0000000000 --- a/examples/declarative/dragtarget/text/dragtext.qml +++ /dev/null @@ -1,182 +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 - -Item { - id: root - width: 320; height: 480 - - Rectangle { - id: inputRect - anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top - anchors.margins: 2 - height: input.implicitHeight + 4 - - border.width: 1 - - TextInput { - id: input - anchors.fill: parent; anchors.margins: 2 - - text: "the quick brown fox jumped over the lazy dog" - - DragTarget { - id: inputTarget - - anchors.fill: parent - - Component { - id: draggedInputText - Text { - x: inputTarget.dragX - y: inputTarget.dragY - text: inputTarget.dragData - color: "blue" - font: input.font - } - } - - Loader { - sourceComponent: parent.containsDrag ? draggedInputText : undefined - } - } - - - MouseArea { - id: inputDraggable - - anchors.fill: parent - enabled: input.selectionStart != input.selectionEnd - - drag.data: input.selectedText - drag.target: inputDraggable - - drag.onDragged: { - var position = input.positionAt(mouse.x); - mouse.accepted = position >= input.selectionStart && position < input.selectionEnd - } - - MouseArea { - anchors.fill: parent - - onPressed: { - var position = input.positionAt(mouse.x); - if (position < input.selectionStart || position >= input.selectionEnd) { - input.cursorPosition = position - } else { - mouse.accepted = false - } - } - onPositionChanged: input.moveCursorSelection(input.positionAt(mouse.x)) - } - } - } - } - - Rectangle { - id: editRect - anchors.left: parent.left; anchors.right: parent.right; - anchors.top: inputRect.bottom; anchors.bottom: parent.bottom - anchors.margins: 2 - - border.width: 1 - - TextEdit { - id: edit - anchors.fill: parent; anchors.margins: 2 - - text: "the quick brown fox jumped over the lazy dog" - font.pixelSize: 18 - wrapMode: TextEdit.WordWrap - - DragTarget { - id: editTarget - - anchors.fill: parent - - - Component { - id: draggedEditText - Text { - x: editTarget.dragX - y: editTarget.dragY - text: editTarget.dragData - color: "red" - font: edit.font - } - } - - Loader { - sourceComponent: parent.containsDrag ? draggedEditText : undefined - } - } - - MouseArea { - id: editDraggable - - anchors.fill: parent - enabled: edit.selectionStart != edit.selectionEnd - - drag.data: edit.selectedText - drag.target: editDraggable - - drag.onDragged: { - var position = edit.positionAt(mouse.x, mouse.y); - mouse.accepted = position >= edit.selectionStart && position < edit.selectionEnd - } - - MouseArea { - anchors.fill: parent - - onPressed: { - var position = edit.positionAt(mouse.x, mouse.y); - if (position < edit.selectionStart || position >= edit.selectionEnd) { - edit.cursorPosition = position - } else { - mouse.accepted = false - } - } - onPositionChanged: edit.moveCursorSelection(edit.positionAt(mouse.x, mouse.y)) - } - } - } - } -} diff --git a/examples/declarative/dragtarget/text/text.qmlproject b/examples/declarative/dragtarget/text/text.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/examples/declarative/dragtarget/text/text.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/modelviews/visualdatamodel/dragselection.qml b/examples/declarative/modelviews/visualdatamodel/dragselection.qml index d4412f9719..afbea1ff94 100644 --- a/examples/declarative/modelviews/visualdatamodel/dragselection.qml +++ b/examples/declarative/modelviews/visualdatamodel/dragselection.qml @@ -69,6 +69,8 @@ Item { width: 64 height: 64 + Drag.active: visibleContainer.drag.active + anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter } states: State { @@ -79,7 +81,7 @@ Item { ParentChange { target: draggable; parent: root } } } - DragTarget { + DropArea { anchors.fill: parent onEntered: visualModel.items.move(selectedItems, 0, packageRoot.VisualDataModel.itemsIndex, selectedItems.count) } |