Forums

OverviewFelgo 2 Support (Qt 5) › AppMap in conjunction with NavigationStack are bogus

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

    Julian

    Hey, it is hard to explain. I’ll first give a working code snippet and then provide the steps to reproduce:

    import Felgo 3.0
    import QtLocation 5.5
    import QtPositioning 5.2
    import QtQuick 2.5
    
    App {
        NavigationStack {
            id: navigationStack
    
            Page {
                title: "Map Overlay"
    
                Component {
                    id: detailPageComponent
    
                    Page {}
                }
    
                // show the map
                AppMap {
                    anchors.fill: parent
                    plugin: Plugin {
                        name: "mapbox"
                        // configure your own map_id and access_token here
                        parameters: [  PluginParameter {
                                name: "mapbox.mapping.map_id"
                                value: "mapbox.streets"
                            },
                            PluginParameter {
                                name: "mapbox.access_token"
                                value: "pk.eyJ1IjoiZ3R2cGxheSIsImEiOiJjaWZ0Y2pkM2cwMXZqdWVsenJhcGZ3ZDl5In0.6xMVtyc0CkYNYup76iMVNQ"
                            },
                            PluginParameter {
                                name: "mapbox.mapping.highdpi_tiles"
                                value: true
                            }]
                    }
                    MapQuickItem {
                        // overlay will be placed at the map center
                        coordinate: QtPositioning.coordinate(parent.userPosition.coordinate.latitude + 0.001, parent.userPosition.coordinate.longitude)
    
                        // the anchor point specifies the point of the sourceItem that will be placed at the given coordinate
                        anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
    
                        // source item holds the actual item that is displayed on the map
                        sourceItem: Rectangle {
                            width: dp(150)
                            height: dp(50)
                            color: "white"
    
                            AppText {
                                text: "This is a marker!"
                                anchors.centerIn: parent
                            }
                        }
    
                        MouseArea {
                            anchors.fill: parent
                            onClicked: navigationStack.push(detailPageComponent)
                        }
                    } // MapQuickItem
    
                    // configure the map to try to display the user's position
                    showUserPosition: true
    
                    // check for user position initially when component is created
                    Component.onCompleted: {
                        if(userPositionAvailable)
                            center = userPosition.coordinate
                    }
    
                    // once we successfully received the location, we zoom to the user position
                    onUserPositionAvailableChanged: {
                        if(userPositionAvailable)
                            zoomToUserPosition()
                    }
                } // AppMap
            }
        }
    }
    

    The code is mainly from https://felgo.com/doc/apps-howtos/#show-user-position with a little bit of extra code to demonstrate the bug.

    Steps to reproduce:

    • Click somewhere in the Marker-rectangle, e.g. in the upper right corner
    • A new empty page is pushed to the navigation stack
    • Go back to the map view via the navigation
    • Immediately click the Marker-rectangle again, but somewhere else, e.g. upper left corner

    Behaviour:

    • What should happen is, that the page is pushed again, but what happens is actually nothing
    • You have to move the map a bit (the marker then jumps to the cursor) to be able to push the page again onto the navigation stack

    I am using Felgo 2.15.1 on macOS. Could someone confirm or refute that?

    Best,

    Julian

    #18711

    Alex
    Felgo Team

    Hi,

    I can confirm that the MouseArea in the MapQuickItem is not reacting to clicks occasionally. The onClicked and onReleased are bot not called correctly, while onPressed and onEntered do work reliably. So I suggest to use one of the latter signals. Does this work for you?

    This looks like a Qt bug, we will have a closer look into this.

    Thanks a lot for reporting.

    Cheers,
    Alex

    #18749

    Julian

    Hi,

    thanks for your answer.

    I cannot confirm that. Changing onClicked to either onPressed or onEntered in my provided example still causes dropped events and not function correctly.

    Is there already a Qt bug to track that issue?

    Best,

    Julian

    #18765

    Günther
    Felgo Team

    Hi Julian,

    There are some bug reports that mention issues with mouse events within Map, though I’m not sure if they are related to this issue. I also did some more tests now, especially with plain Qt types compared to Felgo components.

    It seems the usage of NavigationStack / Page compared to e.g. a setup with plain Qt StackView also affects this bug, we’ll do some more digging!

    Best,
    Günther

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

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support