Quick Menu (quickmenu)

Quick Menu

A QuickMenu widget provides lists of actions organized in tabs with a quick search functionality.

class orangecanvas.document.quickmenu.QuickMenu(parent: QWidget | None = None, **kwargs: Any)[source]

Bases: FramelessWindow

A quick menu popup for the widgets.

The widgets are set using QuickMenu.setModel() which must be a model as returned by QtWidgetRegistry.model()

triggered(QAction)
hovered(QAction)
setSizeGripEnabled(enabled: bool) None[source]

Enable the resizing of the menu with a size grip in a bottom right corner (enabled by default).

sizeGripEnabled() bool[source]

Is the size grip enabled.

addPage(name: str, page: MenuPage) int[source]

Add the page (MenuPage) with name and return it’s index. The page.icon() will be used as the icon in the tab bar.

createPage(index: QModelIndex) MenuPage[source]

Create a new page based on the contents of an index (QModeIndex) item.

setModel(model: QAbstractItemModel) None[source]

Set the model containing the actions.

setSortingFunc(func: Callable[[Any, Any], bool] | None) None[source]

Set a sorting function in the suggest (search) menu.

setFilterFunc(func: FilterFunc | None) None[source]

Set a filter function.

popup(pos: QPoint | None = None, searchText: str = '') None[source]

Popup the menu at pos (in screen coordinates). ‘Search’ text field is initialized with searchText if provided.

exec(pos: QPoint | None = None, searchText: str = '') QAction | None[source]

Execute the menu at position pos (in global screen coordinates). Return the triggered QAction or None if no action was triggered. ‘Search’ text field is initialized with searchText if provided.

hideEvent(event)[source]

Reimplemented from QWidget

setCurrentPage(page: MenuPage) None[source]

Set the current shown page to page.

setCurrentIndex(index: int) None[source]

Set the current page index.

triggerSearch() None[source]

Trigger action search. This changes to current page to the ‘Suggest’ page and sets the keyboard focus to the search line edit.

class orangecanvas.document.quickmenu.MenuPage(parent: ~PyQt5.QtWidgets.QWidget | None = None, title: str = '', icon: ~PyQt5.QtGui.QIcon = <PyQt5.QtGui.QIcon object>, **kwargs: ~typing.Any)[source]

Bases: ToolTree

A menu page in a QuickMenu widget, showing a list of actions. Shown actions can be disabled by setting a filtering function using the setFilterFunc().

setTitle(title: str) None[source]

Set the title of the page.

title() str[source]

Return the title of this page.

setIcon(icon: QIcon) None[source]

Set icon for this menu page.

icon() QIcon[source]

Return the icon of this menu page.

setFilterFunc(func: Callable[[QModelIndex], bool] | None) None[source]

Set the filtering function. func should a function taking a single QModelIndex argument and returning True if the item at index should be disabled and False otherwise. To disable filtering func can be set to None.

setModel(model: QAbstractItemModel) None[source]

Reimplemented from ToolTree.setModel().

setRootIndex(index: QModelIndex) None[source]

Reimplemented from ToolTree.setRootIndex()

rootIndex() QModelIndex[source]

Reimplemented from ToolTree.rootIndex()

sizeHint() QSize[source]

Reimplemented from QWidget.sizeHint().

eventFilter(self, a0: QObject | None, a1: QEvent | None) bool[source]