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

ProgressBarStyle QML Type

Provides custom styling for ProgressBar.

This type was introduced in Qt 5.1.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

ProgressBarStyle QML Type

  • Import Statement: import QtQuick.Controls.Styles 1.4

  • Since: Qt 5.1

  • Group: ProgressBarStyle is part of Styling Controls

Detailed Description

Example:

 
Sélectionnez
ProgressBar {
    value: slider.value
    style: ProgressBarStyle {
        background: Rectangle {
            radius: 2
            color: "lightgray"
            border.color: "gray"
            border.width: 1
            implicitWidth: 200
            implicitHeight: 24
        }
        progress: Rectangle {
            color: "lightsteelblue"
            border.color: "steelblue"
        }
    }
}

Note that the example above is somewhat simplified and will not animate an indeterminate progress bar. The following snippet demonstrates how you can incorporate a custom animation for the indeterminate state as well.

 
Sélectionnez
progress: Rectangle {
    border.color: "steelblue"
    color: "lightsteelblue"

    // Indeterminate animation by animating alternating stripes:
    Item {
        anchors.fill: parent
        anchors.margins: 1
        visible: control.indeterminate
        clip: true
        Row {
            Repeater {
                Rectangle {
                    color: index % 2 ? "steelblue" : "lightsteelblue"
                    width: 20 ; height: control.height
                }
                model: control.width / 20 + 2
            }
            XAnimator on x {
                from: 0 ; to: -40
                loops: Animation.Infinite
                running: control.indeterminate
            }
        }
    }
}

Property Documentation

 

background : Component

The background component for this style.

The implicitWidth and implicitHeight of the background component must be set.

[read-only] control : ProgressBar

The ProgressBar this style is attached to.

[read-only] currentProgress : real

A value in the range [0-1] indicating the current progress.

padding group

padding.bottom : int

padding.left : int

padding.right : int

padding.top : int

This grouped property holds the top, left, right and bottom padding.

panel : Component

The panel component for this style.

progress : Component

The progress component for this style.

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