Warning, /maui/mauikit/src/controls.6/ContextualMenu.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick.Controls 0002 0003 /** 0004 * @inherit QtQuick.Controls.Menu 0005 * @brief A convergent contextual menu that adapats to the screen size and device input method. 0006 * 0007 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-menu.html">This controls inherits from QQC2 Menu, to checkout its inherited properties refer to the Qt Docs.</a> 0008 * 0009 * @image html Misc/contextualmenu.png "The two displays modes" 0010 * 0011 * @code 0012 * Button 0013 * { 0014 * text: "Click Me!" 0015 * onClicked: _contextualMenu.show() 0016 * 0017 * Maui.ContextualMenu 0018 * { 0019 * id: _contextualMenu 0020 * 0021 * title: "Menu Title" 0022 * titleIconSource: "folder" 0023 * 0024 * Action 0025 * { 0026 * text: "Action1" 0027 * icon.name: "love" 0028 * } 0029 * 0030 * Action 0031 * { 0032 * text: "Action2" 0033 * icon.name: "folder" 0034 * } 0035 * 0036 * MenuSeparator {} 0037 * 0038 * MenuItem 0039 * { 0040 * text: "Action3" 0041 * icon.name: "actor" 0042 * } 0043 * 0044 * MenuItem 0045 * { 0046 * text: "Action4" 0047 * icon.name: "anchor" 0048 * } 0049 * } 0050 * } 0051 * @endcode 0052 * 0053 * @section notes Notes 0054 * 0055 * This control will depend on using the Maui Style, for the Menu to have the neded properties. 0056 * The properties of the Menu control form the style are unique to Maui, and obscure the documentation of its functionality, this is done to support thoe properties to also the regular QQC2 Menu control. 0057 * 0058 * The obscured properties are the following: 0059 * - title ContextualMenu::title 0060 * - titleImageSource ContextualMenu::titleImageSource 0061 * - titleIconSource ContextualMenu::titleIconSource 0062 * 0063 * There is also the readonyl property `responsive` which indicates if the menu is being shown in a "responsibe" manner. Resposinve is assigned to mobile devices, and it is positioned in the bottom part of the screen, while on desktop mode the menu popups from where it has been invoked from. 0064 * 0065 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/ContextualMenu.qml">You can find a more complete example at this link.</a> 0066 */ 0067 Menu 0068 { 0069 id: control 0070 0071 /** 0072 * @brief Instead of calling the `open()` function from the Menu control, you should invoke this function. This will take care of positioning the ContextualMenu popup in the right manner. 0073 * @param x The x coordinate where to show the menu popup. This is ignored if the menu is `responsive`. 0074 * @param y The y coordinate where to show the menu popup. This is ignored if the menu is `responsive`. 0075 * @param parent The parent item from where the coordinates are based on to popup the menu. 0076 */ 0077 function show(x, y, parent) 0078 { 0079 if (control.responsive) 0080 { 0081 control.open() 0082 } 0083 else 0084 { 0085 control.popup(parent,x ,y) 0086 } 0087 } 0088 } 0089