In questa pagina

StyleAnimation QML Type

Un tipo di convenienza per l'animazione delle proprietà di stile. Maggiori informazioni...

Import Statement: import Qt.labs.StyleKit
Inherits:

ParallelAnimation

Status: Technology preview

Questo tipo è in anteprima tecnologica ed è soggetto a modifiche.

Proprietà

Descrizione dettagliata

StyleAnimation è un Animation che anima le proprietà di stile quando un controllo cambia state. Ad esempio, impostando animateBackgroundColors su true si animeranno tutte le proprietà di colore del background, quali background.color, background.border.color, background.image.color e background.shadow.color. Viene utilizzato all'interno di 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 è semplicemente un'Animation e di comodità che si occupa automaticamente di elencare le proprietà di stile interessate. Il frammento di codice sopra riportato potrebbe anche essere scritto come:

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

È inoltre possibile utilizzare uno `StyleAnimation` insieme ad altre animazioni:

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: non è garantita la compatibilità dei tipi nei moduli Qt.labs nelle versioni future.

Vedi anche ControlStyle.transition e ControlStyle.

Documentazione sulle proprietà

animateBackgroundBorder : bool

Quando true, si attiva l'border width del delegato background.

animateBackgroundColors : bool

Quando true, anima le proprietà di colore del delegato background, inclusi i colori border e shadow.

Vedi anche animateColors e animateBackgroundGeometry.

animateBackgroundGeometry : bool

Quando true, anima le proprietà geometriche del delegato background, quali width, height e margins.

animateBackgroundRadii : bool

Quando true, viene animato l'angolo radii del delegato background.

animateBackgroundScaleAndRotation : bool

Quando true, anima la rotazione del delegato background.

animateBackgroundShadow : bool

Quando true, anima le proprietà dell'ombra del delegato background, quali vertical offset, horizontal offset, scale e blur. L'ombra color viene animata tramite animateHandleColors.

animateColors : bool

Quando si imposta ` true`, vengono animate tutte le proprietà di colore su tutti i delegati. Si tratta di una sintassi abbreviata che abilita contemporaneamente ` animateBackgroundColors`, ` animateHandleColors` e ` animateIndicatorColors `.

Si noti che ColorAnimation anima anche tutte le proprietà di colore che cambiano durante una transizione quando property e properties non sono impostati. Ciò lo rende un’alternativa a StyleAnimation quando è necessario animare solo i colori.

Vedi anche animateBackgroundColors, animateHandleColors e animateIndicatorColors.

animateControlGeometry : bool

Quando viene chiamato il metodo ` true`, vengono animate le proprietà geometriche del controllo, quali ` spacing ` e ` padding`.

animateHandleBorder : bool

Quando true, si attiva l'border width del delegato handle e il relativo sub-handles.

animateHandleColors : bool

Quando true, anima le proprietà di colore del delegato handle e del suo sub-handles, inclusi i colori border e shadow.

Vedi anche animateColors e animateHandleGeometry.

animateHandleGeometry : bool

Quando true, anima le proprietà geometriche del delegato handle e del suo sub-handles, quali width, height e margins.

animateHandleRadii : bool

Quando true, anima l'angolo radii del delegato handle e il suo sub-handles.

animateHandleScaleAndRotation : bool

Quando true, attiva le proprietà scale e rotation del delegato handle e la sua proprietà sub-handles.

animateHandleShadow : bool

Quando true, anima le proprietà dell'ombra del delegato handle e del suo sub-handles, quali vertical offset, horizontal offset, scale e blur. L'ombra color viene animata tramite animateHandleColors.

animateIndicatorBorder : bool

Quando true, si avvia l'border width del delegato indicator e il relativo sub-indicators.

animateIndicatorColors : bool

Quando si esegue true, vengono animate le proprietà di colore del delegato indicator e del suo sub-indicators, inclusi i colori border e shadow.

Vedi anche animateColors e animateIndicatorGeometry.

animateIndicatorGeometry : bool

Quando true, anima le proprietà geometriche del delegato indicator e del suo sub-indicators, quali width, height e margins.

animateIndicatorRadii : bool

Quando true, anima l'angolo radii del delegato indicator e il suo sub-indicators.

animateIndicatorScaleAndRotation : bool

Quando true, anima la scala e la rotazione del delegato indicator e del suo sub-indicators.

animateIndicatorShadow : bool

Quando si esegue l'operazione " true", vengono animate le proprietà dell'ombra del delegato " indicator " e del suo " sub-indicators", quali " vertical offset", " horizontal offset", " scale" e " blur". L'ombra " color " viene animata tramite " animateHandleColors".

duration : int

La durata dell'animazione in millisecondi.

Vedi anche easing e PropertyAnimation.

easing : EasingCurve

La curva di attenuazione applicata all'animazione.

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