Quick Controls --8.progress bar

1 results

Here Insert Picture Description

2 Introduction

common control progress bar, custom standby.

3 control code

3.1 SenProgressBar .qml

import QtQuick 2.12
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle {
    property int formWidth: 80
    property int formHeight: 20
    property real minValue: 0
    property real maxValue: 100

    width: formWidth
    height: formHeight
    border.width: 1
    border.color: "black"

    ProgressBar {
        id: proBarId
        width: formWidth - 2
        height: formHeight - 2
        anchors {
            verticalCenter: parent.verticalCenter
            horizontalCenter: parent.horizontalCenter
        }

        minimumValue: minValue
        maximumValue: maxValue
        style: ProgressBarStyle {
            background: Rectangle {
                color: "white"
            }
            progress: Rectangle {
                color: "lightgrey"

            }
        }
        value: 20
    }
}

3.2 main.qml

import QtQuick 2.12
import QtQuick.Window 2.12
import "./common" as SenCom

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    SenCom.SenProgressBar {
        anchors.centerIn: parent
    }
}
Published 496 original articles · won praise 601 · Views 1.55 million +

Guess you like

Origin blog.csdn.net/qq_38880380/article/details/104357134