qml自定义SwitchButton
来源:互联网 发布:薛之谦 像风一样 知乎 编辑:程序博客网 时间:2024/06/03 16:15
qml自定义SwitchButton
效果图:
切换选择按钮SwitchButton.qml
import QtQuick 2.0Item { id:root width: bgImage.implicitWidth height: bgImage.implicitHeight property bool selected: false property bool selectAuto: true //替换为自己的图片资源路径 property string bgNormalSource://"Setting/set_wif_connected_close_bg.png" property string bgSelectedSource: //"Setting/set_wif_connected_open_bg.png" property string btnSource://"Setting/set_wif_connected_button.png" signal clicked //默认正常状态 state:"normal" //状态机,"normal" \ "selected" 2种状态 states:[ State{ name:"normal" PropertyChanges { target:bgImage source: bgNormalSource } PropertyChanges { target:btn x:0 -10 }qml自定义SwitchButton when:!selected }, State{ name:"selected" PropertyChanges { target:bgImage source: bgSelectedSource } PropertyChanges { target:btn x:bgImage.width - btn.width +10 } when:selected } ] Image{ id:bgImage anchors.fill: parent Image{ id:btn anchors.verticalCenter: parent.verticalCenter source:btnSource } }//bgImage MouseArea{ id:mainMouse anchors.fill: parent onClicked: { root.clicked() } onReleased: { if(selectAuto){ selected = !selected } } }}
阅读全文
0 0
- qml自定义SwitchButton
- 自定义 SwitchButton
- 自定义SwitchButton
- andorid 自定义SwitchButton
- 仿iOS自定义SwitchButton
- SwitchButton自定义开关
- 自定义滑动开关SwitchButton
- 自定义开关按钮SwitchButton
- 自定义滑动开关-SwitchButton
- 自定义SwitchButton控件
- 自定义适应低版本switchbutton
- android 自定义开关(SwitchButton)
- Android 自定义SwitchButton开关控件
- 一个简单的自定义SwitchButton
- 自定义滑动开关按钮-SwitchButton
- 自定义的一个SwitchButton控件
- 超级简单的自定义SwitchButton
- switchbutton
- Linux Shell中 eval语法调研
- KETTLE使用的注意事项
- 发送端用Jrtplib库进行发送,接收端通过VLC接收并播放——有参考代码
- JAVA使用JCO实现调用SAP接口方法
- Java中String、StringBuffer、StringBuilder的区别
- qml自定义SwitchButton
- Linux系统下的单调时间函数
- Android常用布局的xml属性
- 动态改变TREEVIEW颜色
- 在命令行中通过adb shell am broadcast发送广播通知
- java.lang.reflect.InvocationTargetException
- mysql 连接闪断自动重连的方法(用在后台运行中的PHP代码)
- Maven项目无法读取src/main/resources下properties资源文件
- 友元函数常见问题