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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QML ParentAnimation Element

The ParentAnimation element animates changes in parent values. More...

Inherits Animation

This element was introduced in Qt 4.7.

Properties

Detailed Description

ParentAnimation is used to animate a parent change for an Item.

For example, the following ParentChange changes blueRect to become a child of redRect when it is clicked. The inclusion of the ParentAnimation, which defines a NumberAnimation to be applied during the transition, ensures the item animates smoothly as it moves to its new parent:

 import QtQuick 1.0

 Item {
     width: 200; height: 100

     Rectangle {
         id: redRect
         width: 100; height: 100
         color: "red"
     }

     Rectangle {
         id: blueRect
         x: redRect.width
         width: 50; height: 50
         color: "blue"

         states: State {
             name: "reparented"
             ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
         }

         transitions: Transition {
             ParentAnimation {
                 NumberAnimation { properties: "x,y"; duration: 1000 }
             }
         }

         MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
     }
 }

A ParentAnimation can contain any number of animations. These animations will be run in parallel; to run them sequentially, define them within a SequentialAnimation.

In some cases, such as when reparenting between items with clipping enabled, it is useful to animate the parent change via another item that does not have clipping enabled. Such an item can be set using the via property.

For convenience, when a ParentAnimation is used in a Transition, it will animate any ParentChange that has occurred during the state change. This can be overridden by setting a specific target item using the target property.

Like any other animation element, a ParentAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. The QML Animation and Transitions documentation shows a variety of methods for creating animations.

See also QML Animation and Transitions and Animation basics example.

Property Documentation

newParent : Item

The new parent to animate to.

If the ParentAnimation is defined within a Transition or Behavior, this value defaults to the value defined in the end state of the Transition, or the value of the property change that triggered the Behavior.


target : Item

The item to reparent.

When used in a transition, if no target is specified, all ParentChange occurrences are animated by the ParentAnimation.


via : Item

The item to reparent via. This provides a way to do an unclipped animation when both the old parent and new parent are clipped.

 ParentAnimation {
     target: myItem
     via: topLevelItem
     // ...
 }

Publicit�

Best Of

Actualit�s les plus lues

Semaine
Mois
Ann�e
  1. � Quelque chose ne va vraiment pas avec les d�veloppeurs "modernes" �, un d�veloppeur � "l'ancienne" critique la multiplication des biblioth�ques 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la sp�cification pour la conception d'applications parall�les C++ utilisant le GPU 22
  3. Les d�veloppeurs ignorent-ils trop les failles d�couvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : � 13 % des d�veloppeurs ont gagn� plus de 100 000 $ sur l'AppWord �, Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premi�res images du prochain OS de RIM qui devrait int�grer des widgets et des tuiles inspir�es de Windows Phone 0
  6. Quelles nouveaut�s de C++11 Visual C++ doit-il rapidement int�grer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil d�claratif et extensible pour la compilation de projets Qt 17
Page suivante

Le Qt Quarterly au hasard

Logo

Le rep�rage des paires de parenth�ses avec QSyntaxHighlighter

Qt Quarterly est la revue trimestrielle propos�e par Nokia et � destination des d�veloppeurs Qt. Ces articles d'une grande qualit� technique sont r�dig�s par des experts Qt. Lire l'article.

Communaut�

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la r�daction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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.7
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