当前位置:网站首页>Detailed QML ListView
Detailed QML ListView
2022-08-08 01:04:00 【snow*sleeve*snow】
ListView in QML is roughly the same as Android ListView, which is a list view and one of the most commonly used components.It allows users to scroll off-screen data into the view by sliding (finger down, mouse down, mouse wheel), while the original data on the screen will scroll out of view.A feature of QML ListView is that developers need to define a model, that is, the data displayed by ListView, or ListItem.
Flickable
ListView in QML inherits from the Flickable draggable and flickable component.So some ListViews of Flickable have them. Let's introduce Flickable
Here is an example of using Flickable. In this example, Flickable contains a large image. The view cannot display the entire image at a time, but the view can be dragged by dragging and sliding.There is a scroll bar.
Example source code: flickable
The layout of this example is as follows:
When moving the view down to the right:
Some properties of flickable are marked in the above picture to facilitate understanding of the layout of flickable.
originX and originY are the origin of the content, and their values always refer to the upper-left corner of the content, regardless of the layout orientation.Usually, it is (0, 0), which is the position of the origin of the coordinate system.But ListView and GridView need to be aware that their originX and originY are not necessarily (0, 0), they may have arbitrary origin due to item size change or item insertion/removal outside the visible area.Note that this property is read-only.
content and contentY refer to the relative origin of the Flickable view, which corresponds to the origin of the image in the example above.If there is no sliding, then their values are the same as originX and originY, and the view will change after sliding. For example, if you slide 100 points to the right, then the value of contentX is (originX + 100).If you slide down 100 points, the value of contentY is (originY + 100).You can move the view by changing the values of content and contentY. If you set their values to (originX, originY), the view will return to its original position.
The width and height of a flickable refer to the width and height of its view.
contentWidth and contentHeight indicate the width and height of the displayed content. In the above example, the corresponding picture width and height, the value in the example is larger than the flickable width and height.
边栏推荐
猜你喜欢
随机推荐
BOSS direct hire again explodes erotic recruitment scandal, interviewer's behavior is unsightly
MOSN 反向通道详解
陈强教授《机器学习及R应用》课程 第八章作业
Seaborn调用load_dataset时,出现错误。 urllib.error.URLError: urlopen error [WinError 10054] 远程主机强迫关闭了
PAT甲级 1057 Stack
idea一些debug技巧
继承关系下构造方法的访问特点注意:把this()访问本类其他成员方法也加进去
继承关系下构造方法的访问特点
【目标检测】------非极大值抑制NMS底层
聊聊项目中的缓存-2022新项目
PAT甲级 1058 A+B in Hogwarts
存储系统架构演变
高数_证明_罗尔定理
PAT甲级 1061 Dating
CS8630 无效的 nullable 值: C# 7.3 的“Enable”
pnpm简介和用法
梅科尔工作室-钟伊帆-小熊派学习笔记(网络应用开发)
Is it safe and reliable to open a securities account?
【神器】MarkDown-沉浸写作的利器
2022华数杯数学建模 A题B题C题 思路模型资料汇总









