额…什么都不说了,直接看代码吧

Item{id:itemanchors.fill: parentCamera {id: camerafocus {focusMode: Camera.FocusAuto;focusPointMode: Camera.FocusPointCenter;}captureMode: Camera.CaptureStillImage;imageProcessing {whiteBalanceMode: CameraImageProcessing.WhiteBalanceAuto;}flash.mode: Camera.FlashAuto;imageCapture {onImageCaptured: {// Show the preview in an ImagephotoPreview.source = preview}}}VideoOutput {id:viewfindersource: camerafillMode: Stretchfocus : visible // to receive focus and capture key events when visibleanchors.fill: parentautoOrientation: trueMouseArea{anchors.fill: parentonClicked: {camera.searchAndLock();}}}ZoomControl {id:zoomControlx : 0y : 0z:3width : 100height: parent.heightcurrentZoom: camera.digitalZoommaximumZoom: Math.min(4.0, camera.maximumDigitalZoom)onZoomTo: camera.setDigitalZoom(value)}TLImageButton{id:captureBtnwidth: 60height: widthpicNormal:commonParameter.getSkinPath() + "icon_capture_normal.png"picPressed: commonParameter.getSkinPath() + "icon_capture_press.png"picHover: commonParameter.getSkinPath() + "icon_capture_normal.png"anchors.bottom: parent.bottomanchors.bottomMargin: 8*initWidth/375.0anchors.horizontalCenter: parent.horizontalCenteronClicked: {camera.imageCapture.capture()}}}Image {id: photoPreview}

ZoomControl是自定义的一个滑动条,用于设置拍照焦距的.来看看滑动条代码.

import QtQuick 2.0
import QtMultimedia 5.0Item {id : zoomControlproperty real currentZoom : 1property real maximumZoom : 1signal zoomTo(real value)visible: zoomControl.maximumZoom > 1MouseArea {id : mouseAreaanchors.fill: parentproperty real initialZoom : 0property real initialPos : 0onPressed: {initialPos = mouseYinitialZoom = zoomControl.currentZoom}onPositionChanged: {if (pressed) {var target = initialZoom * Math.pow(5, (initialPos-mouseY)/zoomControl.height);target = Math.max(1, Math.min(target, zoomControl.maximumZoom))zoomControl.zoomTo(target)}}}Item {id : barx : 16y : parent.height/4width : 24height : parent.height/2Rectangle {anchors.fill: parentsmooth: trueradius: 8border.color: "white"border.width: 2color: "black"opacity: 0.3}Rectangle {id: groovex : 0y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0))width: parent.widthheight: parent.height - ysmooth: trueradius: 8color: "white"opacity: 0.5}Text {id: zoomTextanchors {left: bar.right; leftMargin: 16}y: Math.min(parent.height - height, Math.max(0, groove.y - height / 2))text: "x" + Math.round(zoomControl.currentZoom * 100) / 100font.bold: truecolor: "white"style: Text.Raised; styleColor: "black"opacity: 0.85font.pixelSize: 18}}
}

OK 所有代码已奉上.逻辑很简单.

QML Camera 摄像头拍照(带滑动条设置焦距)相关推荐

  1. android gridview滑动监听,Android GridView 滑动条设置一直显示状态(推荐)

    Android GridView 滑动条设置一直显示状态(推荐) 模拟GridView控件: android:id="@+id/picture_grid" android:layo ...

  2. 小程序自制自带滑动条的表格组件

    小程序自制自带滑动条的表格组件 在编写过程中遇到的难点 1. 表格的编写 2. 表格内容宽度固定 长度自适应 3. 滚动条逻辑及代码编写 4. 滚动条的卡段优化 5. 小程序组件的编写及应用 尾声 先 ...

  3. 带滑动条的导航栏(下)---修复浏览器变窄后导航栏变成两条的BUG

    前言 我在演示的过程中,突然发现了一个BUG,如下 全屏时候,还能显示成一行,可缩小浏览器后,一行的浏览器就变成两行了,甚至更多行. 原因 如下图,ul的父元素依次是nav-box . banner. ...

  4. JQuery Slider 实现时间刻度滑动条,用以编辑项目/起始时间(手动输入可自动更新到滑动条)

    最近公司项目应客户要求,web端需要跟桌面端一样实现通过滑动条设置计划起始时间,所以就研究了一下Slider插件,被搞惨了.下面简单描述一下需求. 需求场景:首先,要使用滑动条进行方式进行计划起始时间 ...

  5. linux摄像头拍照程序,Android开发:Camera初探——控制摄像头拍照

    实习接触的项目中需要调用系统摄像头进行拍照,通过完成这个功能点暂时初步了解了Android中的Camera,当然目前只是停留在使用阶段,对于Camera的深度剖析有机会也要了解一下. 通过Camera ...

  6. wdatepicker设置初始时间_滑动条的滑块的初始位置应该放在哪儿?

    滑动条(slider question)是网络调查中独有的一种题型,它由一个有刻度的轴和一个可在轴上来回拖动的滑块组成.受访者在PC或手机屏幕上,通过鼠标或者手指将滑块移动至轴上相应的位置,来完成答题 ...

  7. matlab ktrlink,大神们,怎么设置滑动滑动条然后出来的图形也跟着变化?

    本帖最后由 我叫W儿 于 2016-5-25 20:56 编辑 大神们!我是初学者.在GUI设计中,我把传递函数里的变量以滑动条的形式表达了,但是,运行出图后,再改变滑动条中滑块位置,图不会跟着改变. ...

  8. source insight 设置窗口滑动条

    问题描述:source insight查看代码时,如果每一行的代码偏长,则不好查看代码,此时就需要横向滑动条:同理当代码行数多了,则需要纵向滑动条. 解决: 打开source insight,选择&q ...

  9. linux摄像头如何设置焦距,iPhone XS Max 双摄像头使用技巧 | 苹果手机拍照时如何设置焦距?...

    iPhone XS  Max 双摄像头使用技巧 | 苹果手机拍照时如何设置焦距?手机已经成为主要的拍摄工具,iPhone XS.iPhone XS Max 搭载了两颗强大的摄像头,如何设置才能拍摄更美 ...

最新文章

  1. html常用标签详解4-列表标签
  2. ios--成员变量与属性的区别
  3. 为进大厂刷爆算法题,最后却倒在了基础题上?太苦了!
  4. Codeforces Round #601 (Div. 2) E2. Send Boxes to Alice (Hard Version) 思维 + 质因子
  5. 我们不再需要 Chrome?
  6. 【学术新闻】强强联合!Papers with Code携手arXiv,上传论文、提交代码一步到位...
  7. 2008秋季-计算机软件基础-0917课堂用例(1)
  8. 网页设计基础知识总结
  9. 软件测试--用例编写
  10. 大数据驱动教育变革,产教融合呈现新高度——数据科学与大数据技术教育分论坛顺利召开...
  11. Android集成百度地图实现导航
  12. 仿小米通讯录 右侧滑动条与带动画的悬停列表实现(二)
  13. 隐藏文件去掉隐藏属性
  14. (27)Verilog实现倍频【方法四】
  15. 解决问题:Matlab如何生成或保存无背景图片
  16. 参数化扫描——Comsol中的灵敏度分析功能
  17. IPartDoc Interface 学习笔记
  18. CGI简介用C来写CGI程序简要指南
  19. svn: E170001: 认证失败--文件夹不存在
  20. 转:什么能力很重要,但大多数人却没有

热门文章

  1. 给大家介绍一下:网易云信新晋音视频质量诊断专家
  2. WKWebView-填坑总结
  3. zookeeper在Dubbo中的作用
  4. dedecms的自定义模块
  5. [转]自用类库整理之SqlHelper和MySqlHelper
  6. UITextField详解
  7. 用c#开发微信 系列汇总
  8. Linux环境下C语言模拟内存负载测试
  9. 蚂蚁变大象:浅谈常规网站是如何从小变大的(转)
  10. IIS/ Apache+PHP+MySQL+ Zend Optimizer完全安装手册