Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How does one assign a PieMnuStyle to a PieMenu?
Forum Updated to NodeBB v4.3 + New Features

How does one assign a PieMnuStyle to a PieMenu?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 148 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cmorgan
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved