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

39 lines
811 B
QML
Raw Normal View History

import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.15
ApplicationWindow {
visible: true
2021-04-23 17:56:08 +08:00
width: 600
height: 800
title: qsTr("Scroll")
2021-06-02 09:53:58 +08:00
Rectangle {
2021-06-02 11:07:44 +08:00
anchors.fill: parent
2021-06-02 11:07:44 +08:00
Rectangle {
id: root
2021-03-16 15:20:46 +08:00
2021-06-02 11:07:44 +08:00
width: 200; height: 200
color: "red"
2021-04-16 10:06:15 +08:00
2021-06-02 11:07:44 +08:00
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)
}
}
2021-06-02 09:53:58 +08:00
}
}
2021-06-02 11:07:44 +08:00
}