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: Optional[PyQt5.QtWidgets.QWidget] = None, **kwargs: Any)[source]
Bases:
orangecanvas.gui.framelesswindow.FramelessWindowA quick menu popup for the widgets.
The widgets are set using
QuickMenu.setModel()which must be a model as returned byQtWidgetRegistry.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).
- addPage(name: str, page: orangecanvas.document.quickmenu.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: PyQt5.QtCore.QModelIndex) → orangecanvas.document.quickmenu.MenuPage[source]
Create a new page based on the contents of an index (
QModeIndex) item.
- setModel(model: PyQt5.QtCore.QAbstractItemModel) → None[source]
Set the model containing the actions.
- setSortingFunc(func: Optional[Callable[[Any, Any], bool]]) → None[source]
Set a sorting function in the suggest (search) menu.
- popup(pos: Optional[PyQt5.QtCore.QPoint] = None, searchText: str = '') → None[source]
Popup the menu at pos (in screen coordinates). ‘Search’ text field is initialized with searchText if provided.
- exec(pos: Optional[PyQt5.QtCore.QPoint] = None, searchText: str = '') → Optional[PyQt5.QtWidgets.QAction][source]
Execute the menu at position pos (in global screen coordinates). Return the triggered
QActionor None if no action was triggered. ‘Search’ text field is initialized with searchText if provided.
- setCurrentPage(page: orangecanvas.document.quickmenu.MenuPage) → None[source]
Set the current shown page to page.
- class orangecanvas.document.quickmenu.MenuPage(parent: Optional[PyQt5.QtWidgets.QWidget] = None, title: str = '', icon: PyQt5.QtGui.QIcon = <PyQt5.QtGui.QIcon object>, **kwargs: Any)[source]
Bases:
orangecanvas.gui.tooltree.ToolTreeA menu page in a
QuickMenuwidget, showing a list of actions. Shown actions can be disabled by setting a filtering function using thesetFilterFunc().- setFilterFunc(func: Optional[Callable[[PyQt5.QtCore.QModelIndex], bool]]) → None[source]
Set the filtering function. func should a function taking a single
QModelIndexargument and returning True if the item at index should be disabled and False otherwise. To disable filtering func can be set toNone.
- setModel(model: PyQt5.QtCore.QAbstractItemModel) → None[source]
Reimplemented from
ToolTree.setModel().