You should be able to do this still. Here is some code that should get you on the right track:
import QtQuick 2.6
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import Esri.ArcGISRuntime 100.7
ApplicationWindow {
id: appWindow
width: 800
height: 600
title: "Untitled123"
property bool mouseAccepted: !freePanButton.checked
property var startPoint
property var endPoint
MapView {
anchors.fill: parent
focus: true
GraphicsOverlay {
Graphic {
id: graphic
}
SimpleRenderer {
SimpleFillSymbol {
outline: SimpleLineSymbol {
color: "red"
width: 2
}
color: "transparent"
}
}
}
onMousePressed: {
mouse.accepted = mouseAccepted;
startPoint = mouse.mapPoint;
}
onMousePositionChanged: {
mouse.accepted = mouseAccepted;
endPoint = mouse.mapPoint;
envBuilder.setCorners(startPoint, endPoint);
graphic.geometry = envBuilder.geometry
}
Map {
id: map
BasemapTopographic {}
}
}
EnvelopeBuilder {
id: envBuilder
spatialReference: map.spatialReference
}
ColumnLayout {
RadioButton {
id: freePanButton
checked: true
text: qsTr("Free Pan")
}
RadioButton {
text: qsTr("Draw Rectangle")
}
}
}