QMenu
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
This class is a JS wrapper around Qt's QMenu class
Example
const { QMenu } = require("@nodegui/nodegui");
const menu = new QMenu();
Hierarchy
↳ QMenu
Index
Constructors
Properties
Methods
- _id
- acceptDrops
- accessibleDescription
- accessibleName
- actionAt
- actionGeometry
- activateWindow
- activeAction
- addAction
- addEventListener
- addMenu
- addSection
- addSeparator
- adjustSize
- autoFillBackground
- baseSize
- childAt
- children
- childrenRect
- clear
- clearFocus
- clearMask
- close
- colorCount
- contentsRect
- contextMenuPolicy
- defaultAction
- delete
- deleteLater
- depth
- devicePixelRatio
- devicePixelRatioF
- dumpObjectInfo
- dumpObjectTree
- ensurePolished
- eventProcessed
- exec
- focusProxy
- focusWidget
- font
- frameGeometry
- frameSize
- geometry
- getFlexNode
- grab
- grabKeyboard
- grabMouse
- hasFocus
- hasHeightForWidth
- hasMouseTracking
- hasTabletTracking
- height
- heightForWidth
- heightMM
- hide
- hideTearOffMenu
- icon
- inherits
- inputMethodHints
- insertMenu
- insertSection
- insertSeparator
- isActiveWindow
- isAncestorOf
- isEmpty
- isEnabled
- isEnabledTo
- isFullScreen
- isHidden
- isMaximized
- isMinimized
- isModal
- isTearOffEnabled
- isTearOffMenuVisible
- isVisible
- isVisibleTo
- isWindow
- isWindowModified
- killTimer
- layout
- logicalDpiX
- logicalDpiY
- lower
- mapFrom
- mapFromGlobal
- mapFromParent
- mapTo
- mapToGlobal
- mapToParent
- maximumHeight
- maximumSize
- maximumWidth
- menuAction
- minimumHeight
- minimumSize
- minimumSizeHint
- minimumWidth
- move
- nativeParentWidget
- nextInFocusChain
- normalGeometry
- objectName
- paintingActive
- parent
- parentWidget
- physicalDpiX
- physicalDpiY
- popup
- pos
- previousInFocusChain
- property
- raise
- rect
- releaseKeyboard
- releaseMouse
- releaseShortcut
- removeAction
- removeEventListener
- repaint
- repolish
- resize
- separatorsCollapsible
- setAcceptDrops
- setAccessibleDescription
- setAccessibleName
- setActiveAction
- setAsDockMenu
- setAttribute
- setAutoFillBackground
- setBaseSize
- setContentsMargins
- setContextMenuPolicy
- setCursor
- setDefaultAction
- setDisabled
- setEnabled
- setEventProcessed
- setFixedHeight
- setFixedSize
- setFixedWidth
- setFlexNodeSizeControlled
- setFocus
- setFocusPolicy
- setFocusProxy
- setFont
- setGeometry
- setGraphicsEffect
- setHidden
- setIcon
- setInlineStyle
- setInputMethodHints
- setLayout
- setMaximumHeight
- setMaximumSize
- setMaximumWidth
- setMinimumHeight
- setMinimumSize
- setMinimumWidth
- setMouseTracking
- setObjectName
- setParent
- setProperty
- setSeparatorsCollapsible
- setShortcutAutoRepeat
- setShortcutEnabled
- setSizeIncrement
- setSizePolicy
- setStatusTip
- setStyleSheet
- setTabletTracking
- setTearOffEnabled
- setTitle
- setToolTip
- setToolTipDuration
- setToolTipsVisible
- setUpdatesEnabled
- setVisible
- setWhatsThis
- setWindowFilePath
- setWindowFlag
- setWindowIcon
- setWindowModified
- setWindowOpacity
- setWindowRole
- setWindowState
- setWindowTitle
- show
- showFullScreen
- showMaximized
- showMinimized
- showNormal
- showTearOffMenu
- size
- sizeHint
- sizeIncrement
- stackUnder
- startTimer
- statusTip
- style
- styleSheet
- testAttribute
- title
- toolTip
- toolTipDuration
- toolTipsVisible
- underMouse
- unsetCursor
- unsetLayoutDirection
- unsetLocale
- update
- updateGeometry
- updateMicroFocus
- updatesEnabled
- whatsThis
- width
- widthMM
- winId
- window
- windowFilePath
- windowHandle
- windowIcon
- windowOpacity
- windowRole
- windowState
- windowTitle
- x
- y
Constructors
constructor
+ new QMenu(arg?
: QWidget‹QWidgetSignals› | NativeElement): QMenu
Overrides QAbstractSlider.constructor
Parameters:
Name | Type |
---|---|
arg? | QWidget‹QWidgetSignals› | NativeElement |
Returns: QMenu
Properties
_rawInlineStyle
• _rawInlineStyle: string
Inherited from QMenu._rawInlineStyle
native
• native: NativeElement | null
Inherited from Component.native
type
• type: string
Methods
_id
▸ _id(): number
Get an ID identifying the underlying C++ object.
This can be useful when debugging memory problems with help from
setLogCreateQObject()
and setLogDestroyQObject()
. The number is
hash of the memory address of the C++ object.
Returns: number
a unique number which is valid for the lifetime of the C++ object.
acceptDrops
▸ acceptDrops(): boolean
Inherited from QMenu.acceptDrops
Returns: boolean
accessibleDescription
▸ accessibleDescription(): string
Inherited from QMenu.accessibleDescription
Returns: string
accessibleName
▸ accessibleName(): string
Inherited from QMenu.accessibleName
Returns: string
actionAt
▸ actionAt(pt
: QPoint): QAction
Parameters:
Name | Type |
---|---|
pt | QPoint |
Returns: QAction
actionGeometry
▸ actionGeometry(act
: QAction): QRect
Parameters:
Name | Type |
---|---|
act | QAction |
Returns: QRect
activateWindow
▸ activateWindow(): void
Inherited from QMenu.activateWindow
Returns: void
activeAction
▸ activeAction(): QAction
Returns: QAction
addAction
▸ addAction(action
: QAction | string): QAction
Inherited from QMenu.addAction
Parameters:
Name | Type |
---|---|
action | QAction | string |
Returns: QAction
addEventListener
▸ addEventListener‹SignalType›(signalType
: SignalType, callback
: QMenuSignals[SignalType], options?
: EventListenerOptions): void
Inherited from EventWidget.addEventListener
Type parameters:
▪ SignalType: keyof QMenuSignals
Parameters:
Name | Type | Description |
---|---|---|
signalType | SignalType | SignalType is a signal from the widgets signals interface. |
callback | QMenuSignals[SignalType] | Corresponding callback for the signal as mentioned in the widget's signal interface |
options? | EventListenerOptions | Extra optional options controlling how this event listener is added. |
Returns: void
void
For example in the case of QPushButton:
const button = new QPushButton();
button.addEventListener('clicked',(checked)=>console.log("clicked"));
// here clicked is a value from QPushButtonSignals interface
▸ addEventListener(eventType
: WidgetEventTypes, callback
: function, options?
: EventListenerOptions): void
Inherited from EventWidget.addEventListener
Parameters:
▪ eventType: WidgetEventTypes
▪ callback: function
▸ (event?
: NativeRawPointer‹"QEvent"›): void
Parameters:
Name | Type |
---|---|
event? | NativeRawPointer‹"QEvent"› |