Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › Is there a way to change the width of a SingleSpriteFromFile ?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7774

    Stan

    I am trying to create a bar whose width I can modify dynamically. The bar is constructed of three pieces: a left piece, a middle piece and a right piece. My plan is to adjust the width of the bar by setting the width of the middle piece such that the total width of the three pieces is the desired width of the bar. In other words:

    barWidth = left.width + mid.width + right.width

    If left.width and right.width are both 10 and I want a barWidth of 100, then I will set the mid.width to be 80.

    I have managed to create an Item that does this using Image components but I would ideally like to use SingleSpriteFromFile components so that I can have all my graphics on a sprite sheet. The problem is that I can’t seem to modify the width of the SingleSpriteFromFile components. Is there any way around this?

    #7805

    Alex
    Felgo Team

    Hi Stan,

    can you post some sample code showing the problem? Currently there are no known bugs regarding the modification of the width and height properties of SingleSpriteFromFile.

    Cheers,
    Alex

    #7806

    Stan

    No problems..

     

    SingleSpriteFromFile{
            id:area
    
            // Properties below give start and end x coords of the usable bit of the action bar graphic
            property real barStartX: area.x + 26.0
            property real barEndX: area.x + area.width - 28.0
    
    
            source:"ActionBar.png"
            filename:"../img/imgs-0-sd.json"
            x: -200
            y: 110
            height:  
    
            MouseArea{
                anchors.fill: parent
                onPressed:{
                    markerAnim.stop()
                        if (marker.x  > redArea.x && marker.x < redArea.x + redArea.width){
                          actionBar.result("success");
                        } else {
                          actionBar.result("failure");
                        }
                    timer.running = true
    
                }
    
    
    
            }
        }

     

    #7807

    Alex
    Felgo Team

    Hi Stan,

    are you sure you posted the right code? Your “height” property is blank and i can’t see where you set the width property of your “area”.

    Cheers,
    Alex

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded