IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Positioner QML Type

Provides attached properties that contain details on where an item exists in a positioner.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Positioner QML Type

  • Import Statement: import QtQuick

  • Group: Positioner is part of qtquick-positioners

Detailed Description

An object of type Positioner is attached to the top-level child item within a Column, Row, Flow or Grid. It provides properties that allow a child item to determine where it exists within the layout of its parent Column, Row, Flow or Grid.

For example, below is a Grid with 16 child rectangles, as created through a Repeater. Each Rectangle displays its index in the Grid using Positioner.index, and the first item is colored differently by taking Positioner.isFirstItem into account:

 
Sélectionnez
Grid {
    Repeater {
        model: 16

        Rectangle {
            id: rect
            width: 30; height: 30
            border.width: 1
            color: Positioner.isFirstItem ? "yellow" : "lightsteelblue"

            Text { text: rect.Positioner.index }
        }
    }
}
Image non disponible

Attached Property Documentation

 

[read-only] Positioner.isFirstItem : bool

[read-only] Positioner.isLastItem : bool

These properties allow the item to determine if it is the first or last item in the positioner, respectively.

[read-only] Positioner.index : int

This property allows the item to determine its index within the positioner.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+