-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
44 lines (36 loc) · 1.18 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import QtQuick
import QtQuick.Controls
import org.qfield
import org.qgis
import Theme
import "qrc:/qml" as QFieldItems
Item {
id: plugin
property var mainWindow: iface.mainWindow()
property var dashBoard: iface.findItemByObjectName('dashBoard')
property var overlayFeatureFormDrawer: iface.findItemByObjectName('overlayFeatureFormDrawer')
Component.onCompleted: {
iface.findItemByObjectName('canvasMenu').addItem(pastButton)
}
MenuItem {
id: pastButton
text: qsTr( "Past Feature Into Current Layer" )
icon.source: Theme.getThemeVectorIcon('ic_paste_black_24dp')
enabled: dashBoard.activeLayer.type == 0 && clipboardManager && clipboardManager.holdsFeature
height: 48
leftPadding: 10
font: Theme.defaultFont
onTriggered: {
past()
}
}
function past()
{
let featureFromPastFeature = clipboardManager.pasteFeatureFromClipboard()
let feature = FeatureUtils.createFeature(dashBoard.activeLayer, featureFromPastFeature.geometry)
overlayFeatureFormDrawer.featureModel.feature = feature
overlayFeatureFormDrawer.featureModel.resetAttributes(true)
overlayFeatureFormDrawer.state = 'Add'
overlayFeatureFormDrawer.open()
}
}