QWebEngineContextMenuRequest — PyQt Documentation v6.9.0 (original) (raw)

PyQt6.QtWebEngineCore.QWebEngineContextMenuRequest

Inherits from QObject.

Description

The QWebEngineContextMenuRequest class provides request for populating or extending a context menu with actions.

QWebEngineContextMenuRequest is returned by lastContextMenuRequest() after a context menu event, and contains information about where the context menu event took place. This is also in the context in which any context specific WebAction will be performed.

Enums

EditFlag

The available edit operations in the current context menu request.

Member Value Description
CanCopy 0x8 Copy is available.
CanCut 0x4 Cut is available.
CanDelete 0x20 Delete is available.
CanEditRichly 0x100 Context is richly editable.
CanPaste 0x10 Paste is available.
CanRedo 0x2 Redo is available.
CanSelectAll 0x40 Select All is available.
CanTranslate 0x80 Translate is available.
CanUndo 0x1 Undo is available.

MediaFlag

The current media element’s status and its available operations. MediaNone if the selected web page content is not a media element.

Member Value Description
MediaCanPrint 0x100 Media is printable.
MediaCanRotate 0x200 Media is rotatable.
MediaCanSave 0x10 Media can be saved.
MediaCanToggleControls 0x40 Media can show controls.
MediaControls 0x80 Media controls are shown.
MediaHasAudio 0x20 Media has audio.
MediaInError 0x1 An error occurred.
MediaLoop 0x8 Media can be looped.
MediaMuted 0x4 Media is muted.
MediaPaused 0x2 Media is paused.

MediaType

This enum describes the media type of the context menu request if any.

Member Value Description
MediaTypeAudio 3 The context is an audio element.
MediaTypeCanvas 4 The context is a canvas element.
MediaTypeFile 5 The context is a file.
MediaTypeImage 1 The context is an image element.
MediaTypeNone 0 The context is not a media type.
MediaTypePlugin 6 The context is a plugin element.
MediaTypeVideo 2 The context is a video element.

Methods

editFlags() → EditFlag

Returns the available edit operations in the current context or CanDoNone if no actions are available.


isAccepted() → bool

TODO


isContentEditable() → bool

Returns true if the context menu request is editable by the user; otherwise returns false.


linkText() → str

Returns the text of a link if the context menu request was requested for a link.


linkUrl() → QUrl

Returns the URL of a link if the menu context request is a link. It is not guaranteed to be a valid URL.


mediaFlags() → MediaFlag

Returns the current media element’s status and its available operations. MediaNone if the selected web page content is not a media element.


mediaType() → MediaType

Returns the type of the media element or MediaTypeNone if the context menu requestis not a media element.


mediaUrl() → QUrl

If the context menu request is a media element, returns the URL of that media.


misspelledWord() → str

If the menu context request is a word considered misspelled by the spell-checker, returns the misspelled word.

For possible replacements of the word, see spellCheckerSuggestions().


position() → QPoint

Returns the position of the context menu request, usually the mouse position where the context menu event was triggered.


selectedText() → str

Returns the selected text of the context menu request.


setAccepted(bool)


spellCheckerSuggestions() → list[str]

If the menu context request is a word considered misspelled by the spell-checker, returns a list of suggested replacements for misspelledWord().