ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #01812
Re: Crash on drag and drop
Thanks, but these changes does nothing about the crash. It still crashes when starting to drag. I must have found a bug, but what is the extent of it. Is drag and drop unusable on Ubuntu Touch?
/Linus Rydberg
________________________________________
Från: Ubuntu-phone [ubuntu-phone-bounces+linus.rydberg=cybercom.com@xxxxxxxxxxxxxxxxxxx] för Abraham Helpsing [abrahamvanhelpsing@xxxxxxxxx]
Skickat: den 19 april 2013 14:20
Till: ubuntu-phone@xxxxxxxxxxxxxxxxxxx
Ämne: Re: [Ubuntu-phone] Crash on drag and drop
This is the example code from the Qt project:
import QtQuick 2.0
Item<http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-item.html> {
width: 200; height: 200
DropArea<http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-droparea.html> {
x: 75; y: 75
width: 50; height: 50
Rectangle<http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-rectangle.html> {
anchors.fill: parent
color: "green"
visible: parent.containsDrag
}
}
Rectangle<http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-rectangle.html> {
x: 10; y: 10
width: 20; height: 20
color: "red"
Drag.active: dragArea.drag.active
Drag.hotSpot.x: 10
Drag.hotSpot.y: 10
MouseArea<http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-mousearea.html> {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}
Something I notice:
Your draggable mousearea fills the whole window/application area not the widget you want to drag.
Start with just modifying "Item" to MainView and work from there.
On Fri, Apr 19, 2013 at 12:07 AM, Linus Rydberg <Linus.Rydberg@xxxxxxxxxxxx<mailto:Linus.Rydberg@xxxxxxxxxxxx>> wrote:
Hi
I am not able tu use drag and drop on Ubuntu Touch. It works on the desktop but crashes the application on Ubuntu Touch preview. Does anyone have any idea?
Here is the code that crashes on Nexus 7 using the latest build today (also crashes previous builds).
import QtQuick 2.0
import Ubuntu.Components 0.1
MainView {
objectName: "mainView"
applicationName: "test1"
id: root
width: units.gu<http://units.gu>(100)
height: units.gu<http://units.gu>(100)
MouseArea {
id: mouseArea
anchors.fill: parent
drag.target: dragable
drag.axis: Drag.XAndYAxis
onReleased: {
dragable.Drag.drop(Qt.LinkAction);
}
}
Rectangle {
id: dropzone
x: units.gu<http://units.gu>(30)
y: units.gu<http://units.gu>(30)
width: units.gu<http://units.gu>(20); height: units.gu<http://units.gu>(20)
radius: units.gu<http://units.gu>(10)
color: "black"
DropArea{
anchors.fill: parent
onDropped: {
console.log("onDropped ");
}
onEntered: {
console.log("onEntered ");
}
onExited: {
console.log("onExited ");
}
}
}
Rectangle {
id: dragable
width: units.gu<http://units.gu>(10); height: units.gu<http://units.gu>(10)
radius: units.gu<http://units.gu>(5)
color: "yellow"
Drag.active: mouseArea.drag.active
}
}
--
Mailing list: https://launchpad.net/~ubuntu-phone
Post to : ubuntu-phone@xxxxxxxxxxxxxxxxxxx<mailto:ubuntu-phone@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~ubuntu-phone
More help : https://help.launchpad.net/ListHelp
References