Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!


OverviewFelgo 2 Support (Qt 5) › MouseArea inside object from other QML


Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #15527


    Hello, i was trying to make reusable objects for my game so i made an Button.qml but now when i try to add an MouseArea in my created custom button it dont work. Am i missing something here about this? Because if i create an rectangle and put an mousearea inside that it works just fine.


    Button {
            id: playButton
            buttonFrame: ["PlayButtonUp.png"]
            x: 100
            y: 240
            MouseArea {
                anchors.fill: parent
                onPressed: {



    import Felgo 3.0
    import QtQuick 2.0
    EntityBase {
        id: button
        entityType: "button"
        property alias buttonFrame: buttonTexture.frameNames
        TexturePackerAnimatedSpriteVPlay {
            id: buttonTexture
            source: "../assets/PSFSheet.json"




    Felgo Team


    your Button has no width or height set, so it is 0x0 pixels in size. Your MouseArea fills this Button, so it has no size as well, thus it’s impossible to click it.

    You could simply set the size of the button to the sprite, by using:

    EntitiyBase {
      width: buttonTexture.width
      height: buttonTexture.height
      //... other stuff

    Also since you want a re-usable button, I’d put the MouseArea inside the button and forward the signal, like you can learn in our Getting Started tutorial. I’d highly recommend going through the whole tutorial, I bet it will answer a lot of your upcoming questions 🙂 We also have a video for this tutorial, if you prefer that!




    Hi Alex,


    I thought that the entity already used the width and size of the texture i used. Yup is gonna go through that tutorial=) Thanks for clearing up this for me:)



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

RSS feed for this thread

You must be logged in to reply to this topic.