Nesta página

StyleAnimation QML Type

Um tipo de conveniência para animar propriedades de estilo. Mais...

Import Statement: import Qt.labs.StyleKit
Inherits:

ParallelAnimation

Status: Technology preview

Este tipo está em pré-visualização tecnológica e está sujeito a alterações.

Propriedades

Descrição detalhada

StyleAnimation é um Animation que anima propriedades de estilo quando um controle é alterado state. Por exemplo, definir animateBackgroundColors como true animará todas as propriedades de cor do background, tais como background.color, background.border.color, background.image.color e background.shadow.color. Ele é usado dentro de um 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 é apenas um ` Animation ` de conveniência que lida com a listagem automática das propriedades de estilo afetadas. O trecho de código acima também poderia ser escrito da seguinte forma:

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

Um `StyleAnimation` também pode ser usado em conjunto com outras animações:

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

Observação: não há garantia de que os tipos nos módulos do Qt.labs permanecerão compatíveis em versões futuras.

Veja também ControlStyle.transition e ControlStyle.

Documentação de propriedades

animateBackgroundBorder : bool

Quando ` true` é chamado, ele aciona o método ` border width ` do delegado ` background `.

animateBackgroundColors : bool

Quando true, anima as propriedades de cor do delegado background, incluindo as cores border e shadow.

Veja também animateColors e animateBackgroundGeometry.

animateBackgroundGeometry : bool

Quando ` true` anima as propriedades geométricas do delegado ` background `, tais como ` width`, ` height` e ` margins`.

animateBackgroundRadii : bool

Quando ` true` é chamado, anima o canto ` radii ` do delegado ` background `.

animateBackgroundScaleAndRotation : bool

Quando ` true` é chamado, ele anima a rotação do delegado ` background `.

animateBackgroundShadow : bool

Quando true anima as propriedades de sombra do delegado background, como vertical offset, horizontal offset, scale e blur. A sombra color é animada por animateHandleColors.

animateColors : bool

Quando ` true` é definido, anima todas as propriedades de cor em todos os delegados. Essa é uma forma abreviada de ativar ` animateBackgroundColors`, ` animateHandleColors` e ` animateIndicatorColors ` de uma só vez.

Observe que ColorAnimation também anima todas as propriedades de cor que mudam durante uma transição quando property e properties não estão definidos. Isso o torna uma alternativa a StyleAnimation quando apenas as cores precisam ser animadas.

Veja também animateBackgroundColors, animateHandleColors e animateIndicatorColors.

animateControlGeometry : bool

Quando ` true` anima as propriedades geométricas do controle, como ` spacing ` e ` padding`.

animateHandleBorder : bool

Quando ` true` é chamado, ele anima o ` border width ` do delegado ` handle ` e seu ` sub-handles`.

animateHandleColors : bool

Quando true, anima as propriedades de cor do delegado handle e seu sub-handles, incluindo as cores border e shadow.

Veja também animateColors e animateHandleGeometry.

animateHandleGeometry : bool

Quando ` true` anima as propriedades geométricas do delegado ` handle ` e de seu ` sub-handles`, tais como ` width`, ` height` e ` margins`.

animateHandleRadii : bool

Quando ` true` anima o canto ` radii ` do delegado ` handle ` e seu ` sub-handles`.

animateHandleScaleAndRotation : bool

Quando ` true` anima os métodos ` scale ` e ` rotation ` do delegado ` handle ` e seu ` sub-handles`.

animateHandleShadow : bool

Quando true anima as propriedades de sombra do delegado handle e de seu sub-handles, tais como vertical offset, horizontal offset, scale e blur. A sombra color é animada por animateHandleColors.

animateIndicatorBorder : bool

Quando ` true`, anima o ` border width ` do delegado ` indicator ` e seu ` sub-indicators`.

animateIndicatorColors : bool

Quando true, anima as propriedades de cor do delegado indicator e de seu sub-indicators, incluindo as cores border e shadow.

Veja também animateColors e animateIndicatorGeometry.

animateIndicatorGeometry : bool

Quando true anima as propriedades geométricas do delegado indicator e de seus sub-indicators, tais como width, height e margins.

animateIndicatorRadii : bool

Quando ` true` anima o canto ` radii ` do delegado ` indicator ` e seu ` sub-indicators`.

animateIndicatorScaleAndRotation : bool

Quando ` true` anima a escala e a rotação do delegado ` indicator ` e seu ` sub-indicators`.

animateIndicatorShadow : bool

Quando ` true` anima as propriedades de sombra do delegado ` indicator ` e de seus ` sub-indicators`, tais como ` vertical offset`, ` horizontal offset`, ` scale` e ` blur`. A sombra ` color ` é animada por ` animateHandleColors`.

duration : int

A duração da animação em milissegundos.

Veja também easing e PropertyAnimation.

easing : EasingCurve

A curva de suavização aplicada à animação.

Veja também duration e 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.