Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Basic Elements

Qt Quick includes elements for placing components. These can be combined to form other components.

 import QtQuick 2.0

Basic Elements

This is a list of some of the elements readily available for users.

For a complete list of QML elements, please visit the QML Elements page.

Item Element

Many QML elements inherit Item properties. Item possesses important properties such as focus, children, and dimension properties such as width and height. Although Item has physical properties, it is not a visual element. Using Item as the top-level QML element (as the screen) will not produce a visual result, use the Rectangle element instead. Use the Item to create opacity effects, such as when creating an invisible container to hold other components.

Rectangle Element

The Rectangle element is the basic visual element, for displaying different types of items onto the screen. The Rectangle is customizable and utilizes other elements such as Gradient and BorderImage for displaying advanced customized graphics.

Image Element

To insert an image into a QML scene, merely declare an Image element. The Image element can load images in formats supported by Qt.

Text Elements

The Text and TextEdit elements display formatted text onto the screen. TextEdit features multi-line editing while the TextInput element is for single line text input.

Using Elements as the Top-Level Component

For creating components, there are different elements that could be used as the top-level component. To display a simple scene, a Rectangle as the top-level component may suffice. Rectangle, FocusScope, Component, QtObject, Item, are some of the commonly used elements as the top-level component.

When importing components, the top-level component is important because the top-level component's properties are the only properties exposed to the parent.

For example, a Button component may be implemented using different elements as its top-level component. When this component is loaded into another QML scene, the component will retain the top-level component's properties. If a non-visual component is the top-level component, the visual properties should be aliased to the top-level to display the component properly.

For more information on how to build upon QML elements, see the QML Components document.

Additional Elements

The SQL Local Storage API provides a JavaScript interface to an SQL relational database. The import statement needs a namespace

 import QtQuick.LocalStorage 2.0 as SQL

The QtQuick.Particles module provides a particle system for additional graphics. The Using the Qt Quick Particle System article outlines the system features.

 import QtQuick.Particles 2.0

Extending and Importing Elements

Components may use the basic elements to create new components or to add functionality to existing components. In addition, external component sets may exist to perform logic or provide plugins.

To extend existing elements or to create a custom component, the articles Creating QML Types and The QML Engine contain information about registering new types into the QML engine.

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 5.0-snapshot
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 !
 
 
 
 
Partenaires

Hébergement Web