Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Changing indeterminate ProgressBar indicator color

Changing indeterminate ProgressBar indicator color

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HenrytheEighth
    wrote on last edited by
    #1

    I'm trying to write a splash screen for the KDE environment but I'm having trouble changing the color of the progressBar indicator for indeterminate mode.

    My current implementation:

    import QtQuick 2.5 
    import QtQuick.Controls 2.4 
    
    Rectangle {
        id: background
        anchors.fill: parent
        color: "lightgrey"
        anchors.centerIn: parent 
        
        Image {
            id: logo 
            anchors.centerIn: parent
            source: "../previews/gentoo-signet.svg" 
            sourceSize.width: 400
            sourceSize.height: 400
        }
        
        ProgressBar {
            id: startProg 
            anchors.horizontalCenter: background.horizontalCenter
            anchors.top: logo.bottom 
            anchors.topMargin: 50 
            indeterminate: true 
            width: 400
            height: 4 
    
    /*
            background: Rectangle {
                implicitWidth: parent.width
                implicitHeight: parent.height
                color: '#ffffff'
                radius: 3 
            }
     
            
            contentItem: Item {
                width: 400 
                implicitHeight: 4 
                
                Rectangle {  
                    id: marker  
                    color: "#4e4371"
                    height: parent.height
                    width: parent.width * control.visualPosition  
                    radius: 2 
                } 
            }
    */    
        }
    } 
    

    With the code commented out, the above properly displays an indeterminate progress bar with the black dash indicators. If I uncomment out the section, I get a white rectangle of the proper size, but no progress indicator.

    Any ideas on how I can change the color of the indicator from black to purple (e.g. #4e4371).

    Thanks!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      krokstr
      wrote on last edited by
      #2

      I am looking for the solution of that problem too. Anyone?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        krokstr
        wrote on last edited by
        #3

        Solution found, just add next line to your existing code of ProgressBar.

        Material.accent: Material.Teal

        ProgressBar {
                id: startProg 
                anchors.horizontalCenter: background.horizontalCenter
                anchors.top: logo.bottom 
                anchors.topMargin: 50 
                indeterminate: true 
                width: 400
                height: 4 
        
                Material.accent: Material.Teal
        }
        

        This will change the default Pink to Teal or any colour you like!

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved