I'm extremely new to both QML development and Android development, so I may just be missing something obviously, but I'm struggling with a Menu's location, but only on the Android platform. I've got a settings button down in the lower right corner of my app. When clicked, it should popup() a Menu. On both the Windows and MacOS builds, whenever the button is clicked the menu pops up right near the button. But for some reason on Android, the menu pops up near the middle of the window. As shown in the code below, the menu is populated via a model from the C++ side, if that matters.
I'm using Menu.popup(), which according to the documentation http://doc.qt.io/qt-5/qml-qtquick-controls-menu.html#popup-method, it supposedly " Opens this menu under the mouse cursor. It can block on some platforms, so test it accordingly." On Mac & Windows, that statement seems to hold true, but not on Android. Am I doing something wrong? Relevant QML: import QtQuick 2.2 import QtQuick.Window 2.1 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Extras 1.4 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.3 import QtQml 2.2 Window { id: root visible: true width: 600 height: 1024 Menu { id: settingsMenu Instantiator { model: sModel MenuItem { text: model.display onTriggered: datafeed.slotSetSelectedPort(text) } onObjectAdded: { settingsMenu.insertItem(index, object) //console.log("QML: object added: " + object.text + ", index= " + index); } onObjectRemoved: { settingsMenu.removeItem(object) //console.log("QML: object removed: " + object.text); } } } Button { id: btSettings width: 40 height: 40 style: ButtonStyle { background: Rectangle { implicitWidth: 40 implicitHeight: 40 border.width: control.activeFocus ? 2 : 1 border.color: "#888888" radius: 4 gradient: Gradient { GradientStop { position: 0 color: control.pressed ? "#040404" : "#080808" } GradientStop { position: 1 color: control.pressed ? "#040404" : "#0a0a0a" } } } } x: parent.width - 60 y: parent.height - 60 onClicked: settingsMenu.popup() enabled: !datafeed.connected opacity: enabled ? 1.0 : 0.3 iconSource: "qrc:/images/settings_white.png" } } _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest