ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Qt6 QML Book/模型视图/概念

2021-12-30 17:01:37  阅读:196  来源: 互联网

标签:Qt6 模型 视图 Book each model data view


Concept

概念

A common pattern when developing user interfaces is to keep the representation of the data separate from the visualization. This makes it possible to show the same data in different ways depending on what task the user is performing. For instance, a phone book could be arranged as a vertical list of text entries, or as a grid of pictures of the contacts. In both cases, the data is identical: the phone book, but the visualization differs. This division is commonly referred to as the model-view pattern. In this pattern, the data is referred to as the model, while the visualization is handled by the view.

开发用户界面时,一种常见模式是将数据的表示与可视化分开。这使得可以根据用户正在执行的任务,以不同的方式显示相同的数据。例如,电话簿可以放在一个垂直的文本条目列表中,或者是一个联系人图片网格。在这两种情况下,数据是相同的,都是电话簿,但可视化显示不同。这种划分通常称为模型视图模式。在此模式中,数据称为模型,而可视化由视图完成。

In QML, the model and view are joined by the delegate. The responsibilities are divided as follows: The model provides the data. For each data item, there might be multiple values. In the example above, each phone book entry has a name, a picture, and a number. The data is arranged in a view, in which each item is visualized using a delegate. The task of the view is to arrange the delegates, while each delegate shows the values of each model item to the user.

在QML中,模型model和视图view由委托delegate连接。职责划分如下:模型为每个数据项提供数据,可能有多个值。在上面的示例中,每个电话簿条目都有一个姓名、一张图片和一个电话号码。数据被安排在一个视图中,在该视图中,每个项目都使用委托进行可视化。视图的任务是安排委托,而每个委托向用户显示每个模型项的值。

This means that the delegate knows about the contents of the model and how to visualize it. The view knows about the concept of delegates and how to lay them out. The model only knows about the data it is representing.

这意味着委托知道模型的数据以及如何可视化模型数据。视图了解委托的概念以及如何安排它们。模型只知道它拥有的数据。

 

标签:Qt6,模型,视图,Book,each,model,data,view
来源: https://blog.csdn.net/aggs1990/article/details/122239906

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有