Presenting Data with ViewsViews are containers for collections of items. They are feature-rich and can be customizable to meet style or behavior requirements. A set of standard views are provided in the basic set of Qt Quick graphical elements:
Unlike other views, 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. These elements have properties and behaviors exclusive to each element. Visit their respective documentation for more information. ModelsViews display models onto the screen. A model could be a simple list of integer or a C++ model. To assign a model to a view, bind the view's model property to a model. ListModel { id: petlist ListElement { type: "Cat" } ListElement { type: "Dog" } ListElement { type: "Mouse" } ListElement { type: "Rabbit" } ListElement { type: "Horse" } } ListView { id: view anchors.fill: parent model: petlist delegate: petdelegate } For more information, consult the QML Data Models article. View DelegatesViews need a delegate to visually represent an item in a list. A view will visualize each item list according to the template defined by the delegate. Items in a model are accessible through the index property as well as the item's properties. Component { id: petdelegate Text { id: label font.pixelSize: 24 text: if (index == 0) label.text = type + " (default)" else text: type } } Views allow visual customization through decoration properties such as the header, footer, and section properties. By binding an object, usually another visual object, to these properties, the views are decoratable. A footer may include a Rectangle element showcasing borders or a header that displays a logo on top of the list. Suppose that a specific club wants to decorate its members list with its brand colors. A member list is in a model and the delegate will display the model's content. The club may decorate the members list by binding visual objects to the header and footer properties. The visual object may be defined inline, in another file, or in a Component element. ListView contents may be grouped into sections, where related list items are labeled according to their sections. Further, the sections may be decorated with delegates. A list may contain a list indicating people's names and the team on which team the person belongs. The ListView element has the section attached property that can combine adjacent and related elements into a section. The section's property property is for selecting which list element property to use as sections. The criteria can dictate how the section names are displayed and the delegate is similar to the views' delegate property. |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.8 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com