import QtQuick 2.7
import QtQuick.Controls 1.4
Item {
id: zoomId
width: 200
height: 50
property int m_count: 7
property int m_currentIndex: 5
property var m_currentScaleVal: 1.0
property int m_width: 12
property int m_height: 20
onM_currentIndexChanged: {
m_currentScaleVal = repeaterid.model[m_currentIndex];
}
Row{
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 10
spacing: 10
Item {
width: m_height
height: m_height
Rectangle{width: m_height;height: 5;color: Color.zoomBarLightColor;anchors.centerIn: parent}
MouseArea {
anchors.fill: parent
onClicked: {
if (m_currentIndex > 0) {
m_currentIndex--
}
}
}
}
Repeater {
id: repeaterid
model: [0.5,0.6,0.7,0.8,0.9,1.0,2.0,3.0,4.0,5.0]
delegate: Rectangle {
width: index == m_currentIndex ? m_width : m_width-3
height: index == m_currentIndex ? m_height : m_height-3
color: index == m_currentIndex ? Color.zoomBarLightColor : "#B2AFA9"
radius: 2
}
}
Item {
width: m_height
height: m_height
Rectangle{width: 5;height: m_height;color: Color.zoomBarLightColor;anchors.centerIn: parent }
Rectangle{width: m_height;height: 5;color: Color.zoomBarLightColor;anchors.centerIn: parent }
MouseArea {
anchors.fill: parent
onClicked: {
if (m_currentIndex < 9) {
m_currentIndex++
}
}
}
}
}
}
使用如下:
Rectangle{width: 600; height: 500;color: "#3A3223";
MouseArea{
anchors.fill: parent
onWheel: {//滚轮
var diff = (wheel.angleDelta.y)/120;
if(diff){ zoomitemid.m_currentIndex+=diff;}
}
Rectangle{
x:50
y:50
id: iddragitem; width: 100; height: 100;
scale: zoomitemid.m_currentScaleVal
}
}
Zoom{//放大缩小
id: zoomitemid
width: parent.width
height: 50
anchors.right: parent.right
}
}
qml放大缩小,进度条
原创
©著作权归作者所有:来自51CTO博客作者303103757q的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:qml滚轮事件
下一篇:Qml关于注册c++对象

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux小程序 —— 进度条
今天我们来用Linux来实现我们的第一个小程序 — — 进度条
进度条 #include #define -
控制台打印进度条
控制台打印进度条,实时展示任务进度。
进度条 System Java -
QT进度条控件封装(QML)
5.完整进度条控件代码与主界面qml代码。演示效果,可指定大小,前景色,背景色。3.更新进度的计时器。
qt 开发语言 背景色 进度条 控件 -
QT定制波浪进度条基于QML
外边框,内部水波浪进度颜色,进度百分比与颜色能自定义。完整水波浪进度组件源码 main.qml。
qt 开发语言 进度条 2d 响应时间 -
Flutter进度条Flutter圆形进度条Flutter条形进度条Flutter Progress进度条LinearProgressIndicator
Flutter Progress1 条形无固定值进度条//LinearProgressIndicator不具备设置高度的选项,可以使用SizedBox来设置高度与宽度 SizedBox( child: LinearProgressIndicator(), height: 8.0, width: 200, ),2 圆
flutter progress Progress Flutter进度条 Flutter等待提示 Flutter圆圈 -
bootstrap-进度条--条纹进度条
bootstrap-进度条--条纹进度条
进度条 bootstrap 条纹 -
bootstrap-进度条--彩色进度条
bootstrap-进度条--彩色进度条
进度条 彩色 bootstrap -
android驱动死锁类型
对于未知的技术我们心里总是比较忐忑,当你走进发现原来并不是你想象中那么难,关键是我们需要勇敢迈出第一步----------Bill 2019.08.23 本文分两部分:一、驱动层的添加 &nb
android驱动死锁类型 简单驱动 JNI framworks #include