Presenting Data with QMLIntroductionQt Quick contains a set of standard items that can be used to present data in a number of different ways. For simple user interfaces, Repeaters can be used in combination with Positioners to obtain pieces of data and arrange them in a user interface. However, when large quantities of data are involved, it is often better to use models with the standard views since these contain many built-in display and navigation features. ViewsViews are scrolling containers for collections of items. They are feature-rich, supporting many of the use cases found in typical applications, and can be customized to meet requirements on style and behavior. A set of standard views are provided in the basic set of Qt Quick graphical elements:
Unlike these items, WebView is not a fully-featured view item, and needs to be combined with a Flickable item to create a view that performs like a Web browser. ListViewListView shows a classic list of items with horizontal or vertical placing of items.
The following example shows a minimal ListView displaying a sequence of numbers (using an integer as a model). A simple delegate is used to define an items for each piece of data in the model. import QtQuick 1.0 ListView { width: 50; height: 200 model: 4 delegate: Text { text: index; font.pixelSize: 40 } } GridViewGridView displays items in a grid like an file manager's icon view. PathViewPathView displays items on a path, where the selection remains in the same place and the items move around it. Decorating ViewsHeaders and FootersSectionsNavigationIn traditional user interfaces, views can be scrolled using standard controls, such as scroll bars and arrow buttons. In some situations, it is also possible to drag the view directly by pressing and holding a mouse button while moving the cursor. In touch-based user interfaces, this dragging action is often complemented with a flicking action, where scrolling continues after the user has stopped touching the view. Further Reading© 2008-2010 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. X
|