qml: switch to QtQuick Controls
This commit is contained in:
41
electrum/gui/qml/components/QRScan.qml
Normal file
41
electrum/gui/qml/components/QRScan.qml
Normal file
@@ -0,0 +1,41 @@
|
||||
import QtQuick 2.6
|
||||
import QtMultimedia 5.6
|
||||
|
||||
Item {
|
||||
|
||||
VideoOutput {
|
||||
id: vo
|
||||
anchors.fill: parent
|
||||
source: camera
|
||||
fillMode: VideoOutput.PreserveAspectCrop
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
vo.grabToImage(function(result) {
|
||||
console.log("grab: image=" + (result.image !== undefined) + " url=" + result.url)
|
||||
if (result.image !== undefined) {
|
||||
console.log('scanning image for QR')
|
||||
QR.scanImage(result.image)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Camera {
|
||||
id: camera
|
||||
deviceId: QtMultimedia.defaultCamera.deviceId
|
||||
viewfinder.resolution: "640x480"
|
||||
|
||||
function dumpstats() {
|
||||
console.log(camera.viewfinder.resolution)
|
||||
console.log(camera.viewfinder.minimumFrameRate)
|
||||
console.log(camera.viewfinder.maximumFrameRate)
|
||||
var resolutions = camera.supportedViewfinderResolutions()
|
||||
resolutions.forEach(function(item, i) {
|
||||
console.log('' + item.width + 'x' + item.height)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user