• Eskil Abrahamsen Blomfeldt's avatar
    androiddeployqt: Force Qt Gui dependency for all apps · 73e4f959
    Eskil Abrahamsen Blomfeldt authored
    
    Currently, the only way to launch an Android application is through
    the platform plugin, which of course depends on Qt Gui. This causes
    problems running corelib autotests, since they have QT = core in
    the .pro file and thus will not deploy or load the platform plugin.
    
    At some point, we may have a way to launch pure corelib-applications
    on Android (like services), but until then, we need to hardcore the
    dependency on Qt Gui to make sure these autotests run properly.
    
    Change-Id: Ica794af972a06ec021c1fa28333866296eab96e0
    Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
    73e4f959
Menu.qml 1.40 KiB
import QtQuick 2.0
import "../components/plugin"
MenuBase {
    property ListModel model
    property string selectedText: itemTextAt(selectedIndex)
    property string hoveredText: itemTextAt(hoveredIndex)
    // 'centerSelectedText' means that the menu will be positioned
    //  so that the selected text' top left corner will be at x, y.
    property bool centerSelectedText: true
    // Show, or hide, the popup by setting the 'visible' property:
    visible: false
    onMenuClosed: visible = false
    onModelChanged: if (Component.status === Component.Ready) rebuildMenu()
    Component.onCompleted: rebuildMenu()
    onHoveredIndexChanged: {
        if (hoveredIndex < menuItems.length)
            menuItems[hoveredIndex].emitHovered()
    onSelectedIndexChanged: {
        if (hoveredIndex < menuItems.length)
            menuItems[hoveredIndex].emitSelected()
    onVisibleChanged: {
        if (visible) {
            var globalPos = parent.mapToItem(null, x, y)
            showPopup(globalPos.x, globalPos.y, centerSelectedText ? selectedIndex : 0)
        } else {
            closePopup()
    function rebuildMenu()
        clearMenuItems();
        for (var i=0; i<menuItems.length; ++i)
            addMenuItem(menuItems[i].text)
        if (model != undefined) {
            for (var j=0; j<model.count; ++j)
                addMenuItem(model.get(j).text)