Improved declarative-camera example.
- Fix setting the white balance preset, it was never actually set on the camera - Improved the zoom control style Change-Id: I95c2851e5ad8409dd79306492271f221a61cb10d Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
023c6ebcb9
commit
904881d4a3
@@ -110,6 +110,7 @@ FocusScope {
|
|||||||
text: "Fluorescent"
|
text: "Fluorescent"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onValueChanged: captureControls.camera.imageProcessing.whiteBalanceMode = wbModesButton.value
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraButton {
|
CameraButton {
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ Item {
|
|||||||
property real maximumZoom : 1
|
property real maximumZoom : 1
|
||||||
signal zoomTo(real value)
|
signal zoomTo(real value)
|
||||||
|
|
||||||
|
visible: zoomControl.maximumZoom > 1
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id : mouseArea
|
id : mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -61,7 +63,7 @@ Item {
|
|||||||
|
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
var target = initialZoom * Math.pow(2, (initialPos-mouseY)/zoomControl.height);
|
var target = initialZoom * Math.pow(5, (initialPos-mouseY)/zoomControl.height);
|
||||||
target = Math.max(1, Math.min(target, zoomControl.maximumZoom))
|
target = Math.max(1, Math.min(target, zoomControl.maximumZoom))
|
||||||
zoomControl.zoomTo(target)
|
zoomControl.zoomTo(target)
|
||||||
}
|
}
|
||||||
@@ -74,45 +76,42 @@ Item {
|
|||||||
y : parent.height/4
|
y : parent.height/4
|
||||||
width : 24
|
width : 24
|
||||||
height : parent.height/2
|
height : parent.height/2
|
||||||
opacity : 0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
smooth: true
|
smooth: true
|
||||||
radius: 8
|
radius: 8
|
||||||
border.color: "black"
|
border.color: "white"
|
||||||
border.width: 2
|
border.width: 2
|
||||||
color: "white"
|
color: "black"
|
||||||
opacity: 0.3
|
opacity: 0.3
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: groove
|
||||||
x : 0
|
x : 0
|
||||||
y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0))
|
y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0))
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - y
|
height: parent.height - y
|
||||||
smooth: true
|
smooth: true
|
||||||
radius: 8
|
radius: 8
|
||||||
color: "black"
|
color: "white"
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
states: State {
|
Text {
|
||||||
name: "ShowBar"
|
id: zoomText
|
||||||
when: mouseArea.pressed || zoomControl.currentZoom > 1.0
|
anchors {
|
||||||
PropertyChanges { target: bar; opacity: 1 }
|
left: bar.right; leftMargin: 16
|
||||||
}
|
}
|
||||||
|
y: Math.min(parent.height - height, Math.max(0, groove.y - height / 2))
|
||||||
transitions: [
|
text: "x" + Math.round(zoomControl.currentZoom * 100) / 100
|
||||||
Transition {
|
font.bold: true
|
||||||
to : "ShowBar"
|
color: "white"
|
||||||
NumberAnimation { properties: "opacity"; duration: 100 }
|
style: Text.Raised; styleColor: "black"
|
||||||
},
|
opacity: 0.85
|
||||||
Transition {
|
font.pixelSize: 18
|
||||||
from : "ShowBar"
|
|
||||||
NumberAnimation { properties: "opacity"; duration: 500 }
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user