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

Forums

OverviewFelgo 3 Support (Qt 5) › Image transparency

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12611

    Kevin

    Hi, so I have my code something like this (modification of existing tutorial project “multiple scenes and multiple levels”)

    I am basically try to change the backbutton from a text based button to a transparent png icon instead.

    But for some reason the PNG icon transparency is not working and its showing up as an arrow with a square box around it.

    Is there something i need to do to allow “transparency” on an Image?

    MenuButton.qml

    Rectangle {
        id: button
    
    
        width: bg.width
        height: bg.height
    
        property alias bg: bg.source
    
        Image {
            id: bg
        }
    
    .....

     

    SelectLevelScene.qml

    import Felgo 3.0
    import QtQuick 2.0
    import "../common"
    
    SceneBase {
      id:selectLevelScene
    
      //.....
    
      MenuButton {
    
        bg: "../../assets/back.png"
        anchors.right: selectLevelScene.gameWindowAnchorItem.right
        anchors.rightMargin: 10
        anchors.top: selectLevelScene.gameWindowAnchorItem.top
        anchors.topMargin: 10
        onClicked: backButtonPressed()
      }
    }
    

     

    #12614

    Lorenz

    Hi Kevin,

    the transparency should work out of the box.

    The problem is that the rectangle which is enclosing your image has a color by the default. The fix is to add

    Rectangle {
      color: "transparent"
      ...
    }

    to your rectangle 🙂

    Please let me know if that helps.

    Cheers,

    Lorenz from Felgo

Viewing 2 posts - 1 through 2 (of 2 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