This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/app/test-layout.qml
2021-07-21 19:03:29 +08:00

39 lines
811 B
QML

import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.15
ApplicationWindow {
visible: true
width: 600
height: 800
title: qsTr("Scroll")
Rectangle {
anchors.fill: parent
Rectangle {
id: root
width: 200; height: 200
color: "red"
Drag.active: dragArea.drag.active
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
onPositionChanged: {
var positionToParent = mapToItem(root.parent, mouse.x, mouse.y)
var positionToRoot = mapToItem(root, mouse.x, mouse.y)
console.log(positionToParent, positionToRoot)
}
}
}
}
}