I want to crop the Image in qml, like this
crop [flickr.com]
The region surrounded by the rectangle is the region I want to crop
Do Qt provide any tools to make this job easier?
import QtQuick 2.1
import QtQuick.Controls 1.0
//import QtQuick.Layouts 1.0
//import QtQuick.Dialogs 1.0
Rectangle {
id: root
width: 1200
height: 600
Rectangle{
anchors.fill: parent
color: "black"
Rectangle{
id: rectDrag
height: 100
width: 100
color: "transparent"
border.width: 5
border.color: "green"
Drag.active: dragArea.drag.active
radius: 10
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}
}
I can drag the rectangle and find out the coordinates of the rectangle
But there are two questions I don’t know how to solve
1 : How could I adjust the size of rectDrag by pulling the corners of the rectDrag?
2 : After I select the region, I need to translate the coordinates(region) to the coordinates
of the original image, how could I translate the coordinates after scaling by the
fillMode—Image.PreserveAspectFit?
edit: found Qt offer a rubberband class in c++, maybe I could use it to implement the
rubberband?
↧