En esta página

StyleAnimation QML Type

Un tipo de conveniencia para animar propiedades de estilo. Más información...

Import Statement: import Qt.labs.StyleKit
Inherits:

ParallelAnimation

Status: Technology preview

Este tipo se encuentra en fase de vista previa tecnológica y está sujeto a cambios.

Propiedades

Descripción detallada

StyleAnimation es un Animation que anima las propiedades de estilo cuando cambia un control state. Por ejemplo, al establecer animateBackgroundColors en true se animarán todas las propiedades de color de background, tales como background.color, background.border.color, background.image.color y background.shadow.color. Se utiliza dentro de un transition:

comboBox {
    background.color: "lightgray"
    hovered.background.color: "plum"

    indicator.color: "white"
    hovered.indicator.color: "pink"
    hovered.indicator.border.width: 4

    transition: Transition {
        StyleAnimation {
            animateBackgroundColors: true
            animateIndicatorColors: true
            animateIndicatorBorder: true
            easing.type: Easing.OutQuad
            duration: 500
        }
    }
}

StyleAnimation es simplemente un « Animation » que facilita el trabajo y se encarga de enumerar automáticamente las propiedades de estilo afectadas. El fragmento de código anterior también podría escribirse así:

checkBox {
    background.color: "lightgray"
    hovered.background.color: "plum"

    indicator.color: "white"
    hovered.indicator.color: "pink"
    hovered.indicator.border.width: 4

    transition: Transition {
        ColorAnimation {
            properties: "background.color, background.border.color, background.image.color, background.shadow.color"
            + ", indicator.color, indicator.border.color, indicator.image.color, indicator.shadow.color"
            easing.type: Easing.OutQuad
            duration: 500
        }
        NumberAnimation {
            properties: "indicator.border.width"
            easing.type: Easing.OutQuad
            duration: 500
        }
    }
}

StyleAnimation también se puede utilizar junto con otras animaciones:

slider {
    handle.color: "white"
    hovered.handle.color: "seagreen"
    hovered.handle.border.width: 8

    transition: Transition {
        StyleAnimation {
            animateHandleColors: true
            easing.type: Easing.OutQuad
            duration: 500
        }
        NumberAnimation {
            properties: "handle.border.width"
            easing.type: Easing.OutBounce
            duration: 1000
        }
    }
}

Nota: No se garantiza que los tipos de los módulos de Qt.labs sigan siendo compatibles en futuras versiones.

Véase también ControlStyle.transition y ControlStyle.

Documentación de propiedades

animateBackgroundBorder : bool

Cuando se ejecuta ` true`, se activa el método ` border width ` del delegado ` background `.

animateBackgroundColors : bool

Cuando se ejecuta true, se animan las propiedades de color del delegado background, incluidos los colores border y shadow.

Véase también animateColors y animateBackgroundGeometry.

animateBackgroundGeometry : bool

Cuando true anima las propiedades geométricas del delegado background, tales como width, height y margins.

animateBackgroundRadii : bool

Cuando se ejecuta « true », se anima el elemento « radii » del delegado « background ».

animateBackgroundScaleAndRotation : bool

Cuando se ejecuta ` true`, se activan la rotación y el desplazamiento del delegado ` background `.

animateBackgroundShadow : bool

Cuando true anima las propiedades de sombra del delegado background, tales como vertical offset, horizontal offset, scale y blur. La sombra color se anima mediante animateHandleColors.

animateColors : bool

Cuando se utiliza ` true`, se animan todas las propiedades de color en todos los delegados. Se trata de una forma abreviada de habilitar ` animateBackgroundColors`, ` animateHandleColors` y ` animateIndicatorColors ` a la vez.

Ten en cuenta que ColorAnimation también anima todas las propiedades de color que cambian durante una transición cuando property y properties no están establecidos. Esto lo convierte en una alternativa a StyleAnimation cuando solo es necesario animar los colores.

Véase también animateBackgroundColors, animateHandleColors y animateIndicatorColors.

animateControlGeometry : bool

Cuando se ejecuta « true », se animan las propiedades geométricas del control, como « spacing » y « padding ».

animateHandleBorder : bool

Cuando true, activa el border width del delegado handle y su sub-handles.

animateHandleColors : bool

Cuando se ejecuta « true », se animan las propiedades de color del delegado « handle » y su « sub-handles », incluidos los colores « border » y « shadow ».

Véase también animateColors y animateHandleGeometry.

animateHandleGeometry : bool

Cuando true, anima las propiedades geométricas del delegado handle y de su sub-handles, tales como width, height y margins.

animateHandleRadii : bool

Cuando se ejecuta ` true`, se anima el elemento de esquina ` radii ` del delegado ` handle ` y su ` sub-handles`.

animateHandleScaleAndRotation : bool

Cuando true activa las propiedades scale y rotation del delegado handle y su sub-handles.

animateHandleShadow : bool

Cuando se ejecuta ` true`, se animan las propiedades de sombra del delegado ` handle ` y de su ` sub-handles`, tales como ` vertical offset`, ` horizontal offset`, ` scale` y ` blur`. La sombra ` color ` se anima mediante ` animateHandleColors`.

animateIndicatorBorder : bool

Cuando true, activa el método border width del delegado indicator y su método sub-indicators.

animateIndicatorColors : bool

Cuando se ejecuta true, se animan las propiedades de color del delegado indicator y su sub-indicators, incluidos los colores border y shadow.

Véase también animateColors y animateIndicatorGeometry.

animateIndicatorGeometry : bool

Cuando true anima las propiedades geométricas del delegado indicator y de su sub-indicators, tales como width, height y margins.

animateIndicatorRadii : bool

Cuando se ejecuta ` true`, se anima el elemento de esquina ` radii ` del delegado ` indicator ` y su ` sub-indicators`.

animateIndicatorScaleAndRotation : bool

Cuando se ejecuta « true », se animan la escala y la rotación del delegado « indicator » y su « sub-indicators ».

animateIndicatorShadow : bool

Cuando se ejecuta « true », se animan las propiedades de sombra del delegado « indicator » y de su « sub-indicators », tales como « vertical offset », « horizontal offset », « scale » y « blur ». La sombra « color » se anima mediante « animateHandleColors ».

duration : int

La duración de la animación en milisegundos.

Véase también easing y PropertyAnimation.

easing : EasingCurve

La curva de suavizado aplicada a la animación.

Véase también duration y PropertyAnimation.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.