| The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||

| The Following 4 Users Say Thank You to velox For This Useful Post: | ||
Rectangle {
id: rect
anchors {
top: parent.top
topMargin: Theme.paddingMedium
horizontalCenter: parent.horizontalCenter
//......other code
}
MouseArea {
//....other code
onPressed: {
rect.anchors.top = undefined
rect.anchors.topMargin = undefined
rect.anchors.horizontalCenter = undefined
}
}
| The Following User Says Thank You to Markkyboy For This Useful Post: | ||
| The Following User Says Thank You to coderus For This Useful Post: | ||
Item {
id: foo
anchors.fill: parent
Rectangle {
id: rect
width: 270; height: 270
color: "transparent"
anchors {
top: parent.top
topMargin: -Theme.paddingMedium
horizontalCenter: parent.horizontalCenter
}
Drag.active: dragArea.drag.active
Rectangle {
width: 270; height: 270
opacity: 0.5; radius: 90
color: Theme.highlightDimmerColor
anchors.centerIn: rect
}
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: rect
drag.axis: Drag.XandYAxis
drag.minimumX: 10
drag.maximumX: 270
drag.minimumY: -10
drag.maximumY: 600
//these numbers work in landscape
//drag.minimumX: 10
//drag.maximumX: 680
//drag.minimumY: 10
//drag.maximumY: 200
onPressed: {
rect.anchors.top = undefined
rect.anchors.topMargin = undefined
rect.anchors.horizontalCenter = undefined
}
}
}
}
| The Following User Says Thank You to Markkyboy For This Useful Post: | ||
| The Following User Says Thank You to velox For This Useful Post: | ||
| The Following User Says Thank You to Markkyboy For This Useful Post: | ||
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
Item {
id: foo
anchors.fill: parent
Rectangle {
id: rect
width: 270; height: 270
color: "transparent"
// y: Theme.paddingMedium
// x: (page.width - rect.width) /2
// Drag.active: dragArea.drag.active ??
Component.onCompleted: {
y = Theme.paddingMedium
x = (page.width - rect.width) /2
}
Rectangle {
width: 270; height: 270
opacity: 0.9; radius: 90
color: Theme.highlightDimmerColor
anchors.centerIn: rect
}
MouseArea {
id: dragArea
anchors.fill: parent
property real dragMaxX: page.width - Theme.paddingMedium - rect.width
property real dragMaxY: page.height - Theme.paddingMedium - Theme.itemSizeHuge - rect.height
drag.target: rect
drag.axis: Drag.XandYAxis
drag.minimumX: Theme.paddingMedium
drag.maximumX: dragMaxX
drag.minimumY: Theme.paddingMedium
drag.maximumY: dragMaxY
Label {
anchors.centerIn: parent
text: "x: " + Math.round(rect.x) + "\ny: " + Math.round(rect.y)
}
drag.onMaximumXChanged: {
if (rect.x > dragMaxX)
rect.x = dragMaxX
}
drag.onMaximumYChanged: {
if (rect.y > dragMaxY)
rect.y = dragMaxY
}
}
}
}
}
| The Following User Says Thank You to elros34 For This Useful Post: | ||
| The Following User Says Thank You to Markkyboy For This Useful Post: | ||
import QtQuick 2.0
import Sailfish.Silica 1.0
// y: Theme.paddingMedium
// x: (page.width - rect.width) /2
// Drag.active: dragArea.drag.active ??
Component.onCompleted: {
y = Theme.paddingMedium
x = (page.width - rect.width) /2
}
| The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||