Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How does one assign a PieMnuStyle to a PieMenu?



  • I have made a PieMenu (pictured below), but I cant seem to figure out how to make it look different

     // radial menu for widget options
        PieMenu
        {
            id: pieMenu
            style: pieStyle
    
            // you're welcome Qt - I fixed your function for you
            function addWorkingItem(text, fun)
            {
                var newItems = __protectedScope.copyItemsToJsArray();
                var newItem = Qt.createQmlObject("import QtQuick.Controls 1.4; MenuItem {onTriggered:"+fun+"}", pieMenu, "");
                newItem.text = text;
                newItems.splice(menuItems.length, 0, newItem);
    
                menuItems = newItems;
                return newItem;
            }
        }
    
    
        PieMenuStyle {
            id: pieSytle
            shadowRadius: 0
    
            menuItem: Item {
                id: item
                rotation: -90 + sectionCenterAngle(styleData.index)
    
                Rectangle {
                    width: parent.height * 0.2
                    height: width
                    color: "darkorange"
                    radius: width / 2
                    anchors.right: parent.right
                    anchors.verticalCenter: parent.verticalCenter
    
                    Text {
                        id: textItem
                        text: control.menuItems[styleData.index].text
                        anchors.centerIn: parent
                        color: control.currentIndex === styleData.index ? "red" : "white"
                        rotation: -item.rotation
                    }
                }
            }
        }
    

    pieMenuStyle code from Qt PieMenuStyle
    I've also tried having it as a child, but I get this error: c9727142-da0a-4c45-8621-92c2822845f5-image.png

    Here's my include list:

    import QtQuick 2.0                 // Item
    import QtQuick.Extras 1.4          // PieMenu
    import QtQuick.Controls.Styles 1.4 // PieMenuStyle
    

    any help is very appreciated, thank you,
    Cody


Log in to reply