PySide6.QtWebEngineCore.QWebEngineContextMenuRequest

class QWebEngineContextMenuRequest

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

Details

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.

Inheritance diagram of PySide6.QtWebEngineCore.QWebEngineContextMenuRequest

Synopsis

Properties

  • acceptedᅟ - Whether the request is accepted

  • editFlagsᅟ - Available edit operations in the current context

  • isContentEditableᅟ - Whether the context menu request is editable by the user

  • linkTextᅟ - Text of a link if the context menu request was requested for a link

  • linkUrlᅟ - URL of a link if the menu context request is a link

  • mediaFlagsᅟ - Current media element’s status and its available operations

  • mediaTypeᅟ - Type of the media element or MediaTypeNone if the context menu request is not a media element

  • mediaUrlᅟ - URL of the media element if the context menu request is a media element

  • misspelledWordᅟ - Misspelled word if the menu context request is a word considered misspelled by the spell-checker

  • positionᅟ - Of the context menu request, usually the mouse position where the context menu event was triggered

  • selectedTextᅟ - Selected text of the context menu request

  • spellCheckerSuggestionsᅟ - A list of suggested replacements for misspelledWord() if the menu context request is a word considered misspelled by the spell-checker

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

class MediaType

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

Constant

Description

QWebEngineContextMenuRequest.MediaType.MediaTypeNone

The context is not a media type.

QWebEngineContextMenuRequest.MediaType.MediaTypeImage

The context is an image element.

QWebEngineContextMenuRequest.MediaType.MediaTypeVideo

The context is a video element.

QWebEngineContextMenuRequest.MediaType.MediaTypeAudio

The context is an audio element.

QWebEngineContextMenuRequest.MediaType.MediaTypeCanvas

The context is a canvas element.

QWebEngineContextMenuRequest.MediaType.MediaTypeFile

The context is a file.

QWebEngineContextMenuRequest.MediaType.MediaTypePlugin

The context is a plugin element.

class MediaFlag

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

Constant

Description

QWebEngineContextMenuRequest.MediaFlag.MediaInError

An error occurred.

QWebEngineContextMenuRequest.MediaFlag.MediaPaused

Media is paused.

QWebEngineContextMenuRequest.MediaFlag.MediaMuted

Media is muted.

QWebEngineContextMenuRequest.MediaFlag.MediaLoop

Media can be looped.

QWebEngineContextMenuRequest.MediaFlag.MediaCanSave

Media can be saved.

QWebEngineContextMenuRequest.MediaFlag.MediaHasAudio

Media has audio.

QWebEngineContextMenuRequest.MediaFlag.MediaCanToggleControls

Media can show controls.

QWebEngineContextMenuRequest.MediaFlag.MediaControls

Media controls are shown.

QWebEngineContextMenuRequest.MediaFlag.MediaCanPrint

Media is printable.

QWebEngineContextMenuRequest.MediaFlag.MediaCanRotate

Media is rotatable.

class EditFlag

(inherits enum.Flag) The available edit operations in the current context menu request.

Constant

Description

QWebEngineContextMenuRequest.EditFlag.CanUndo

Undo is available.

QWebEngineContextMenuRequest.EditFlag.CanRedo

Redo is available.

QWebEngineContextMenuRequest.EditFlag.CanCut

Cut is available.

QWebEngineContextMenuRequest.EditFlag.CanCopy

Copy is available.

QWebEngineContextMenuRequest.EditFlag.CanPaste

Paste is available.

QWebEngineContextMenuRequest.EditFlag.CanDelete

Delete is available.

QWebEngineContextMenuRequest.EditFlag.CanSelectAll

Select All is available.

QWebEngineContextMenuRequest.EditFlag.CanTranslate

Translate is available.

QWebEngineContextMenuRequest.EditFlag.CanEditRichly

Context is richly editable.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property acceptedᅟ: bool

This property holds Whether the request is accepted..

Access functions:
property editFlagsᅟ: Combination of QWebEngineContextMenuRequest.EditFlag

This property holds The available edit operations in the current context..

Returns CanDoNone if no actions are available.

Access functions:
property isContentEditableᅟ: bool

This property holds Whether the context menu request is editable by the user..

Access functions:
property linkTextᅟ: str

This property holds The text of a link if the context menu request was requested for a link..

Access functions:
property linkUrlᅟ: QUrl

This property holds The URL of a link if the menu context request is a link..

It is not guaranteed to be a valid URL.

Access functions:
property mediaFlagsᅟ: Combination of QWebEngineContextMenuRequest.MediaFlag

This property holds The current media element’s status and its available operations..

Returns MediaNone if the selected web page content is not a media element.

Access functions:
property mediaTypeᅟ: QWebEngineContextMenuRequest.MediaType

This property holds The type of the media element or MediaTypeNone if the context menu request is not a media element..

Access functions:
property mediaUrlᅟ: QUrl

This property holds The URL of the media element if the context menu request is a media element..

Access functions:
property misspelledWordᅟ: str

This property holds The misspelled word if the menu context request is a word considered misspelled by the spell-checker..

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

Access functions:
property positionᅟ: QPoint

This property holds The position of the context menu request, usually the mouse position where the context menu event was triggered..

Access functions:
property selectedTextᅟ: str

This property holds The selected text of the context menu request..

Access functions:
property spellCheckerSuggestionsᅟ: list of strings

This property holds A list of suggested replacements for misspelledWord() if the menu context request is a word considered misspelled by the spell-checker..

Access functions:
editFlags()
Return type:

Combination of EditFlag

Getter of property editFlagsᅟ .

isAccepted()
Return type:

bool

Getter of property acceptedᅟ .

isContentEditable()
Return type:

bool

Getter of property isContentEditableᅟ .

linkText()
Return type:

str

Getter of property linkTextᅟ .

linkUrl()
Return type:

QUrl

Getter of property linkUrlᅟ .

mediaFlags()
Return type:

Combination of MediaFlag

Getter of property mediaFlagsᅟ .

mediaType()
Return type:

MediaType

Getter of property mediaTypeᅟ .

mediaUrl()
Return type:

QUrl

Getter of property mediaUrlᅟ .

misspelledWord()
Return type:

str

Getter of property misspelledWordᅟ .

position()
Return type:

QPoint

Getter of property positionᅟ .

selectedText()
Return type:

str

Getter of property selectedTextᅟ .

setAccepted(accepted)
Parameters:

accepted – bool

See also

isAccepted()

Setter of property acceptedᅟ .

spellCheckerSuggestions()
Return type:

list of strings

Getter of property spellCheckerSuggestionsᅟ .