menu

Module Contents

CustomMenuStyle

Custom menu style

DWMMenu

A menu with DWM shadow

MenuAnimationType

Menu animation type

SubMenuItemWidget

Sub menu item

MenuItemDelegate

Menu item delegate

ShortcutMenuItemDelegate

Shortcut key menu item delegate

MenuActionListWidget

Menu action list widget

RoundMenu

Round corner menu

MenuAnimationManager

Menu animation manager

DummyMenuAnimationManager

Dummy menu animation manager

DropDownMenuAnimationManager

Drop down menu animation manager

PullUpMenuAnimationManager

Pull up menu animation manager

FadeInDropDownMenuAnimationManager

Fade in drop down menu animation manager

FadeInPullUpMenuAnimationManager

Fade in pull up menu animation manager

EditMenu

Edit menu

LineEditMenu

Line edit menu

TextEditMenu

Text edit menu

IndicatorMenuItemDelegate

Menu item delegate with indicator

CheckableMenuItemDelegate

Checkable menu item delegate

RadioIndicatorMenuItemDelegate

Checkable menu item delegate with radio indicator

CheckIndicatorMenuItemDelegate

Checkable menu item delegate with check indicator

MenuIndicatorType

Menu indicator type

CheckableMenu

Checkable menu

SystemTrayMenu

System tray menu

CheckableSystemTrayMenu

Checkable system tray menu

LabelContextMenu

Label context menu

createCheckableMenuItemDelegate(style)

create checkable menu item delegate

class CustomMenuStyle(iconSize=14)

Bases: PyQt5.QtWidgets.QProxyStyle

Custom menu style

iconSize = 14
pixelMetric(metric, option, widget)
class DWMMenu(title='', parent=None)

Bases: PyQt5.QtWidgets.QMenu

A menu with DWM shadow

windowEffect
event(e: PyQt5.QtCore.QEvent)
class MenuAnimationType

Bases: enum.Enum

Menu animation type

NONE = 0
DROP_DOWN = 1
PULL_UP = 2
FADE_IN_DROP_DOWN = 3
FADE_IN_PULL_UP = 4
class SubMenuItemWidget(menu, item, parent=None)

Bases: PyQt5.QtWidgets.QWidget

Sub menu item

showMenuSig
menu
item
enterEvent(e)
paintEvent(e)
class MenuItemDelegate(parent=None)

Bases: PyQt5.QtWidgets.QStyledItemDelegate

Menu item delegate

tooltipDelegate = None
paint(painter, option, index)
helpEvent(event, view, option, index)
class ShortcutMenuItemDelegate(parent=None)

Bases: MenuItemDelegate

Shortcut key menu item delegate

paint(painter: PyQt5.QtGui.QPainter, option: PyQt5.QtWidgets.QStyleOptionViewItem, index: PyQt5.QtCore.QModelIndex)
class MenuActionListWidget(parent=None)

Bases: PyQt5.QtWidgets.QListWidget

Menu action list widget

scrollDelegate
insertItem(row, item)

inserts menu item at the position in the list given by row

addItem(item)

add menu item at the end

takeItem(row)

delete item from list

adjustSize(pos=None, aniType=MenuAnimationType.NONE)
setItemHeight(height: int)

set the height of item

setMaxVisibleItems(num: int)

set the maximum visible items

maxVisibleItems()
heightForAnimation(pos: PyQt5.QtCore.QPoint, aniType: MenuAnimationType)

height for animation

itemsHeight()

Return the height of all items

class RoundMenu(title='', parent=None)

Bases: PyQt5.QtWidgets.QMenu

Round corner menu

closedSignal
isSubMenu = False
parentMenu = None
menuItem = None
lastHoverItem = None
lastHoverSubMenuItem = None
isHideBySystem = True
itemHeight = 28
hBoxLayout
view
aniManager = None
timer
setMaxVisibleItems(num: int)

set the maximum visible items

setItemHeight(height)

set the height of menu item

setShadowEffect(blurRadius=30, offset=(0, 8), color=QColor(0, 0, 0, 30))

add shadow to dialog

adjustSize()
icon()
title()
clear()

clear all actions

setIcon(icon: PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase)

set the icon of menu

setTitle(title: str)
addAction(action: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action)

add action to menu

Parameters

action: QAction

menu action

addWidget(widget: PyQt5.QtWidgets.QWidget, selectable=True, onClick=None)

add custom widget

Parameters

widget: QWidget

custom widget

selectable: bool

whether the menu item is selectable

onClick: callable

the slot connected to item clicked signal

insertAction(before: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action, action: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action)

inserts action to menu, before the action before

addActions(actions: List[PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action])

add actions to menu

Parameters

actions: Iterable[QAction]

menu actions

insertActions(before: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action, actions: List[PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action])

inserts the actions actions to menu, before the action before

removeAction(action: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action)

remove action from menu

removeMenu(menu)

remove submenu

setDefaultAction(action: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action)

set the default action

addMenu(menu)

add sub menu

Parameters

menu: RoundMenu

sub round menu

insertMenu(before: PyQt5.QtWidgets.QAction | qfluentwidgets.common.icon.Action, menu)

insert menu before action before

addSeparator()

add seperator to menu

hideEvent(e)
closeEvent(e)
menuActions()
mousePressEvent(e)
mouseMoveEvent(e)
exec(pos, ani=True, aniType=MenuAnimationType.DROP_DOWN)

show menu

Parameters

pos: QPoint

pop-up position

ani: bool

Whether to show pop-up animation

aniType: MenuAnimationType

menu animation type

exec_(pos: PyQt5.QtCore.QPoint, ani=True, aniType=MenuAnimationType.DROP_DOWN)

show menu

Parameters

pos: QPoint

pop-up position

ani: bool

Whether to show pop-up animation

aniType: MenuAnimationType

menu animation type

adjustPosition()
paintEvent(e)
class MenuAnimationManager(menu: RoundMenu)

Bases: PyQt5.QtCore.QObject

Menu animation manager

managers
menu
ani
availableViewSize(pos: PyQt5.QtCore.QPoint)

Return the available size of view

exec(pos: PyQt5.QtCore.QPoint)
classmethod register(name)

register menu animation manager

Parameters

name: Any

the name of manager, it should be unique

classmethod make(menu: RoundMenu, aniType: MenuAnimationType)
class DummyMenuAnimationManager(menu: RoundMenu)

Bases: MenuAnimationManager

Dummy menu animation manager

exec(pos: PyQt5.QtCore.QPoint)
class DropDownMenuAnimationManager(menu: RoundMenu)

Bases: MenuAnimationManager

Drop down menu animation manager

exec(pos)
availableViewSize(pos: PyQt5.QtCore.QPoint)

Return the available size of view

class PullUpMenuAnimationManager(menu: RoundMenu)

Bases: MenuAnimationManager

Pull up menu animation manager

exec(pos)
availableViewSize(pos: PyQt5.QtCore.QPoint)

Return the available size of view

class FadeInDropDownMenuAnimationManager(menu: RoundMenu)

Bases: MenuAnimationManager

Fade in drop down menu animation manager

opacityAni
aniGroup
exec(pos)
availableViewSize(pos: PyQt5.QtCore.QPoint)

Return the available size of view

class FadeInPullUpMenuAnimationManager(menu: RoundMenu)

Bases: MenuAnimationManager

Fade in pull up menu animation manager

opacityAni
aniGroup
exec(pos)
availableViewSize(pos: PyQt5.QtCore.QPoint)

Return the available size of view

class EditMenu(title='', parent=None)

Bases: RoundMenu

Edit menu

createActions()
exec(pos, ani=True, aniType=MenuAnimationType.DROP_DOWN)

show menu

Parameters

pos: QPoint

pop-up position

ani: bool

Whether to show pop-up animation

aniType: MenuAnimationType

menu animation type

class LineEditMenu(parent: PyQt5.QtWidgets.QLineEdit)

Bases: EditMenu

Line edit menu

selectionStart
selectionLength
class TextEditMenu(parent: PyQt5.QtWidgets.QTextEdit)

Bases: EditMenu

Text edit menu

selectionStart
selectionLength
class IndicatorMenuItemDelegate(parent=None)

Bases: MenuItemDelegate

Menu item delegate with indicator

paint(painter: PyQt5.QtGui.QPainter, option, index)
class CheckableMenuItemDelegate(parent=None)

Bases: ShortcutMenuItemDelegate

Checkable menu item delegate

paint(painter: PyQt5.QtGui.QPainter, option: PyQt5.QtWidgets.QStyleOptionViewItem, index: PyQt5.QtCore.QModelIndex)
class RadioIndicatorMenuItemDelegate(parent=None)

Bases: CheckableMenuItemDelegate

Checkable menu item delegate with radio indicator

class CheckIndicatorMenuItemDelegate(parent=None)

Bases: CheckableMenuItemDelegate

Checkable menu item delegate with check indicator

class MenuIndicatorType

Bases: enum.Enum

Menu indicator type

CHECK = 0
RADIO = 1
createCheckableMenuItemDelegate(style: MenuIndicatorType)

create checkable menu item delegate

class CheckableMenu(title='', parent=None, indicatorType=MenuIndicatorType.CHECK)

Bases: RoundMenu

Checkable menu

class SystemTrayMenu(title='', parent=None)

Bases: RoundMenu

System tray menu

sizeHint() PyQt5.QtCore.QSize
class CheckableSystemTrayMenu(title='', parent=None, indicatorType=MenuIndicatorType.CHECK)

Bases: CheckableMenu

Checkable system tray menu

sizeHint() PyQt5.QtCore.QSize
class LabelContextMenu(parent: PyQt5.QtWidgets.QLabel)

Bases: RoundMenu

Label context menu

selectedText
copyAct
selectAllAct
label() PyQt5.QtWidgets.QLabel
exec(pos, ani=True, aniType=MenuAnimationType.DROP_DOWN)

show menu

Parameters

pos: QPoint

pop-up position

ani: bool

Whether to show pop-up animation

aniType: MenuAnimationType

menu animation type