ContextualMenu

Search for usage in LXR

ContextualMenu Class Reference
Inheritance diagram for ContextualMenu:

Public Member Functions

void show (x, y, parent)
 
- Public Member Functions inherited from QtQuick.Controls.Menu
Action actionAt (int index)
 
void addAction (Action action)
 
void addItem (Item item)
 
void addMenu (Menu menu)
 
void dismiss ()
 
void insertAction (int index, Action action)
 
void insertItem (int index, Item item)
 
void insertMenu (int index, Menu menu)
 
Item itemAt (int index)
 
Menu menuAt (int index)
 
void moveItem (int from, int to)
 
void popup (Item parent, MenuItem item)
 
void popup (Item parent, point pos, MenuItem item)
 
void popup (Item parent, real x, real y, MenuItem item)
 
void popup (MenuItem item)
 
void popup (point pos, MenuItem item)
 
void popup (real x, real y, MenuItem item)
 
void removeAction (Action action)
 
void removeItem (Item item)
 
void removeMenu (Menu menu)
 
Action takeAction (int index)
 
MenuItem takeItem (int index)
 
Menu takeMenu (int index)
 

Detailed Description

A convergent contextual menu that adapats to the screen size and device input method.

This controls inherits from QQC2 Menu, to checkout its inherited properties refer to the Qt Docs.

The two displays modes
{
text: "Click Me!"
onClicked: _contextualMenu.show()
Maui.ContextualMenu
{
id: _contextualMenu
title: "Menu Title"
titleIconSource: "folder"
{
text: "Action1"
icon.name: "love"
}
{
text: "Action2"
icon.name: "folder"
}
MenuSeparator {}
MenuItem
{
text: "Action3"
icon.name: "actor"
}
MenuItem
{
text: "Action4"
icon.name: "anchor"
}
}
}

Notes

This control will depend on using the Maui Style, for the Menu to have the neded properties. 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.

The obscured properties are the following:

  • title ContextualMenu::title
  • titleImageSource ContextualMenu::titleImageSource
  • titleIconSource ContextualMenu::titleIconSource

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.

You can find a more complete example at this link.

Definition at line 66 of file ContextualMenu.qml.

Member Function Documentation

◆ show()

void ContextualMenu::show ( x ,
y ,
parent  )

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.

Parameters
xThe x coordinate where to show the menu popup. This is ignored if the menu is responsive.
yThe y coordinate where to show the menu popup. This is ignored if the menu is responsive.
parentThe parent item from where the coordinates are based on to popup the menu.

The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:48:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.