Obsolete Members for PieMenu

The following members of QML type PieMenu are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Properties

Property Documentation

boundingItem : Item

The item which the menu must stay within.

A typical use case for PieMenu involves:

  • A MouseArea that determines the clickable area within which the menu can be opened.
  • The bounds that the menu must not go outside of.

Although they sound similar, they have different purposes. Consider the example below:

Canvas boundingItem example

The user can only open the menu within the inner rectangle. In this case, they've opened the menu on the edge of the MouseArea, but there would not be enough room to display the entire menu centered at the cursor position, so it was moved to the left.

If for some reason we didn't want this restriction, we can set boundingItem to null:

Canvas null boundingItem example

By default, the menu's parent is the boundingItem.


[read-only] currentIndex : int

The index of the the menu item that is currently under the mouse, or -1 if there is no such item.


[read-only] currentItem : int

The menu item that is currently under the mouse, or null if there is no such item.


The list of menu items displayed by this menu.

You can assign menu items by declaring them as children of PieMenu:

PieMenu {
    MenuItem {
        text: "Action 1"
        onTriggered: function() { print("Action 1"); }
    }
    MenuItem {
        text: "Action 2"
        onTriggered: function() { print("Action 2"); }
    }
    MenuItem {
        text: "Action 3"
        onTriggered: function() { print("Action 3"); }
    }
}

[read-only] selectionAngle : real

This property reflects the angle (in radians) created by the imaginary line from the center of the menu to the position of the cursor.

Its value is undefined when the menu is not visible.


title : string

This property defines the text that is shown above the menu when there is no current menu item (currentIndex is -1).

The default value is "" (an empty string).


triggerMode : int

This property determines the method for selecting items in the menu.

  • A triggerMode of TriggerMode.TriggerOnPress means that menu items will only be selected when a mouse press event occurs over them.
  • A triggerMode of TriggerMode.TriggerOnRelease means that menu items will only be selected when a mouse release event occurs over them. This means that the user must keep the mouse button down after opening the menu and release the mouse over the item they wish to select.
  • A triggerMode of TriggerMode.TriggerOnClick means that menu items will only be selected when the user clicks once over them.

Warning: Changing the triggerMode while the menu is visible will result in undefined behavior.


© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.