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. Custom progress bar [ Involves both horizontal and vertical movement]

Custom progress bar [ Involves both horizontal and vertical movement]

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 1.5k 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
    hkay
    wrote on 9 Jan 2018, 12:09 last edited by
    #1

    Hi All,
    I have been working to bring a new design progress bar for my project . I have a sketch in my hand but am finding it difficult to implement. Please provide any input for how to proceed!
    I have attached a rough image on how I want the progress to be shown : progress bar design
    alt text

    I have limited knowledge in qml and I am asking in the light of a previous project I have done which was a volume bar in which the progress was shown by adjusting the height of an image and using number animation to make it smooth.

    I used an Item class for a window inside which I placed an image and changed it height according to the input value. But such a possibility exists only for a vertical or horizontal progress . If I try to attempt it in this case, the revealing comes out like this:
    alt text

    If such a design is to be implemented using qml, what could be the approaches I could follow? Is there a way in which I can reveal a complete image in parts like I had explained before for the volume bar or should I use the Qpainter() ?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrecKo
      Qt Champions 2018
      wrote on 9 Jan 2018, 13:28 last edited by
      #2

      If you want to do that in QML, look at the new Shape module in Qt 5.10, or do it with Canvas.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ODБOï
        wrote on 10 Jan 2018, 10:43 last edited by ODБOï 1 Oct 2018, 11:12
        #3

        @hkay hello,

        I did this simple exemple (QML/JS),i hope It can give you ideas.

        //

        import QtQuick 2.0
        
        Item {
            property int val:1
            property int maxValue:50
            property int minValue:0
        
            Timer{// test timer
                interval: 200
                running: true
                repeat: running
        
                property bool up: true
                onTriggered: {
                    if(up&&val<maxValue){
                        val++
                        if(val===maxValue){
                            up=false
                        }
                    }else{
                      val--
                        if(val==minValue) up = true
                    }
                }
            }
        
            function colorVal(val, ind)   // instead of returning colors you can return image path like "images/01.png"
            {
                if(val === 0) return "gray"
                var temp = maxValue-3
                if(ind <= temp)
                {
                    if(ind < temp - 3 )return "green"
                    else return "orange"
                }
                else return "red"
            }
        
            function widthVal(val, ind)
            {
                if(val === 0) return 35
                var temp = maxValue - 3
                if(ind <= temp)
                {
                    if(ind < temp-3 )return 35
                    else return 75
                }
                else return 155
            }
        
        
            Column{
                //anchors.fill: parent
                spacing: 1
                Repeater{
                    model : val
                    anchors.right: parent.right
        
                    Rectangle{ // here you can put an Image instead of Rectangle, and set 'source :  function imgageVal(val, ind) '
                        height: color=="red" ? 3 : 5
                        width: widthVal(val,index)
                        color: colorVal(val,index)
                        x:index
                    }
                }
            }
        
        }
        
        

        LA

        1 Reply Last reply
        0

        3/3

        10 Jan 2018, 10:43

        • Login

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