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


OverviewFelgo 3 Support (Qt 5) › cameraVPlay question

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


    Hi guys,

    I am now using cameraVPlay in my level editor with the following behaviours:

    1. When level editing the camera is in free mode and can be dragged to display different parts of the game area.
    2. When I click on an entity, the camera centres on that entity.  At this point my level editor also opens up an entity editor that I have created.

    I have managed this behaviour by setting – mouseArea.propagateComposedEvents: true – within my cameraVPlay component.  This allows for the click to be ignored by the cameraVPlay.mouseArea and instead handled by my entity which sits beneath it.  This is how I have managed to make it possible to click on the entity whilst level editing.


    Whilst I am editing the entity I need to be able to drag the entity to other parts of the screen – allowing the user to reposition it.  I also want to be able to zoom in and out using pinchZoom.

    In order to achieve the behaviour of dragging the entity around the screen, I need to temporarily turn off the drag feature of cameraVPlay.  I have achieved this so far by disabling the mouseArea with – camera.mouseAreaEnabled = false.

    Unfortunately this also turns off the pinchZoom.


    Is it possible, whilst in camera free-move mode, to either disable the drag feature, or to propagate the drag to an object behind the camera – so that it could be handled by my draggable entity?


    The – mouseArea.propagateComposedEvents: true – does not propagate the drag event to the entity beneath the camera.  I assume because the cameraVPlay.mouseArea has a handler for the drag event.


    Can you see a way around this issue?

    If it is not possible, I do have another solution by using a slider to zoom in / out instead of pinchZoom, but would prefer to use pinchZoom if possible.


    I have copied the relevant part of my code below if that helps…


    Thank you





            target: levelUI
            onEntityBeingEdited:{//(entityToEdit) - signal recieved with details of entity being edited. Lock camera on this entity
                camera.mouseAreaEnabled = false
                camera.zoom = 1
                camera.centerFreeCameraOn(entityToEdit.x + entityToEdit.width / 2,entityToEdit.y + entityToEdit.height / 2)
            onReturnToLevelEditing:{//entity no longer being edited, back in general level editing. Unlock camera
                camera.mouseAreaEnabled = true
       CameraVPlay {
          id: camera
          maxZoom: 1
          gameWindowSize: Qt.point(gameScene.width,gameScene.height)
          entityContainer: container
          focusedObject: activeLevel.tank_player//this gets changed by my state machine to free mode when level editing 
          allowZoomWithFocus: true
          mouseArea.propagateComposedEvents: true



    Felgo Team

    Hi Darren,

    I just followed up on this via email!


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