Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[QgsQuick] Use generic function onImageCapture otherwise use default …
- Loading branch information
|
@@ -118,6 +118,22 @@ Item { |
|
|
return (prefix) ? prefix + "/" + pathFromValue : pathFromValue |
|
|
} |
|
|
|
|
|
function showDefaultPanel() { |
|
|
if (!photoCapturePanelLoader.item) { |
|
|
// Load the photo capture panel if not loaded yet |
|
|
photoCapturePanelLoader.setSource("qgsquickphotopanel.qml") |
|
|
photoCapturePanelLoader.item.height = window.height |
|
|
photoCapturePanelLoader.item.width = window.width |
|
|
photoCapturePanelLoader.item.edge = Qt.RightEdge |
|
|
photoCapturePanelLoader.item.imageButtonSize = fieldItem.iconSize |
|
|
photoCapturePanelLoader.item.backButtonSource = fieldItem.backIcon |
|
|
} |
|
|
photoCapturePanelLoader.item.visible = true |
|
|
photoCapturePanelLoader.item.targetDir = targetDir |
|
|
photoCapturePanelLoader.item.prefixToRelativePath = prefixToRelativePath |
|
|
photoCapturePanelLoader.item.fieldItem = fieldItem |
|
|
} |
|
|
|
|
|
id: fieldItem |
|
|
enabled: true // its interactive widget |
|
|
height: customStyle.fields.height * 3 |
|
@@ -259,20 +275,11 @@ Item { |
|
|
MouseArea { |
|
|
anchors.fill: parent |
|
|
onClicked: { |
|
|
var photoCapturePanel = photoCapturePanelLoader.item |
|
|
if (!photoCapturePanelLoader.item) { |
|
|
// Load the photo capture panel if not loaded yet |
|
|
photoCapturePanelLoader.setSource("qgsquickphotopanel.qml") |
|
|
photoCapturePanelLoader.item.height = window.height |
|
|
photoCapturePanelLoader.item.width = window.width |
|
|
photoCapturePanelLoader.item.edge = Qt.RightEdge |
|
|
photoCapturePanelLoader.item.imageButtonSize = fieldItem.iconSize |
|
|
photoCapturePanelLoader.item.backButtonSource = fieldItem.backIcon |
|
|
if (externalResourceHandler.capturePhoto) { |
|
|
externalResourceHandler.capturePhoto(fieldItem) |
|
|
} else { |
|
|
showDefaultPanel() |
|
|
} |
|
|
photoCapturePanelLoader.item.visible = true |
|
|
photoCapturePanelLoader.item.targetDir = targetDir |
|
|
photoCapturePanelLoader.item.prefixToRelativePath = prefixToRelativePath |
|
|
photoCapturePanelLoader.item.fieldItem = fieldItem |
|
|
} |
|
|
} |
|
|
} |
|
|
|
@@ -41,6 +41,13 @@ Item { |
|
|
*/ |
|
|
property var externalResourceHandler: QtObject { |
|
|
|
|
|
/** |
|
|
* Called when clicked on the camera icon to capture an image. |
|
|
* \param itemWidget editorWidget for modified field to send valueChanged signal. |
|
|
*/ |
|
|
property var capturePhoto: function captureImage(itemWidget) { |
|
|
} |
|
|
|
|
|
/** |
|
|
* Called when clicked on the gallery icon to choose a file in a gallery. |
|
|
* \param itemWidget editorWidget for modified field to send valueChanged signal. |
|
|