• Laszlo Agocs's avatar
    Dynamic GL: remove exporting symbols · 4b2f35d0
    Laszlo Agocs authored
    
    Remove the opengl proxy for now. Later it will either be moved into
    a separate library or replaced by a QOpenGLFunctions-based approach.
    
    This means that the -opengl dynamic configuration is not usable
    for the time being. The rest of the enablers remain in place.
    
    The convenience function QOpenGLFunctions::isES() is now moved to
    QOpenGLContext and is changed to check the renderable type. This is
    extremely useful since besides supporting dynamic GL it solves also
    the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES
    path when creating an ES-compatible context with a desktop OpenGL
    implementation).
    
    Task-number: QTBUG-36483
    Task-number: QTBUG-37172
    Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca
    Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
    Reviewed-by: default avatarJørgen Lind <jorgen.lind@digia.com>
    4b2f35d0
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)