Solved Map, context menu and disappear tile
-
I have this little test program (code below). Whenever I popup the context menu on the map, and start move the mouse to select menu item (don't do anything else), there will seem to be a tile disappear on the map. The tile will show up again if I click away from the menu to close it. The closest similar issue posted is QtLocation and Drawer Issues, but nobody answer there.
Thank you!
main.qml
import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Window 2.12 import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.3 import QtLocation 5.12 import QtPositioning 5.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Plugin { id:mapPlugin name:"esri" //"googlemaps""osm" } Map { anchors.fill: parent plugin: mapPlugin activeMapType: supportedMapTypes[1] center: QtPositioning.coordinate(28.0949, -80.6968) zoomLevel: 14 MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { contextMnu.popup(); } } Menu { id:contextMnu MenuItem { text: "Add stuff" } MenuItem { text: "Edit stuff" } MenuItem { text: "Delete stuff" } } } }
Boilerplate main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
-
@TonyN hi
since there is no answer, and i can observe the same issue with qt5.14 mingw64 but can't solve it, i can suggest an alternative..
using a QML Popup Type instead of MenuWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") Plugin { id:mapPlugin name: "esri" //"googlemaps""osm" } Map { z:1 id:map anchors.fill: parent plugin: mapPlugin activeMapType: supportedMapTypes[1] center: QtPositioning.coordinate(28.0949, -80.6968) zoomLevel: 14 onErrorStringChanged: console.log("map error : " + map.errorString) MouseArea { id:mouse anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { contextMnu.open(); } } Popup{ id:contextMnu x : mouse.mouseX y : mouse.mouseY ColumnLayout { anchors.fill: parent Button { text: qsTr("Add") } Button{ text: qsTr("Edit") } Button { text: qsTr("Delete") } } } } }
-
@LeLev OK, that works. Thanks