QWebEngineContextMenuRequest Class

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

Header: #include <QWebEngineContextMenuRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 6.2
Inherits: QObject

Public Types

enum EditFlag { CanUndo, CanRedo, CanCut, CanCopy, CanPaste, …, CanEditRichly }
flags EditFlags
enum MediaFlag { MediaInError, MediaPaused, MediaMuted, MediaLoop, MediaCanSave, …, MediaCanRotate }
flags MediaFlags
enum MediaType { MediaTypeNone, MediaTypeImage, MediaTypeVideo, MediaTypeAudio, MediaTypeCanvas, …, MediaTypePlugin }

Properties

Public Functions

virtual ~QWebEngineContextMenuRequest()
QWebEngineContextMenuRequest::EditFlags editFlags() const
bool isAccepted() const
bool isContentEditable() const
QString linkText() const
QUrl linkUrl() const
QWebEngineContextMenuRequest::MediaFlags mediaFlags() const
QWebEngineContextMenuRequest::MediaType mediaType() const
QUrl mediaUrl() const
QString misspelledWord() const
QPoint position() const
QString selectedText() const
void setAccepted(bool accepted)
QStringList spellCheckerSuggestions() const

Detailed Description

QWebEngineContextMenuRequest is returned by QWebEngineView::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 QWebEnginePage::WebAction will be performed.

Member Type Documentation

[since 6.2] enum QWebEngineContextMenuRequest::EditFlag
flags QWebEngineContextMenuRequest::EditFlags

The available edit operations in the current context menu request.

ConstantValueDescription
QWebEngineContextMenuRequest::CanUndo0x1Undo is available.
QWebEngineContextMenuRequest::CanRedo0x2Redo is available.
QWebEngineContextMenuRequest::CanCut0x4Cut is available.
QWebEngineContextMenuRequest::CanCopy0x8Copy is available.
QWebEngineContextMenuRequest::CanPaste0x10Paste is available.
QWebEngineContextMenuRequest::CanDelete0x20Delete is available.
QWebEngineContextMenuRequest::CanSelectAll0x40Select All is available.
QWebEngineContextMenuRequest::CanTranslate0x80Translate is available.
QWebEngineContextMenuRequest::CanEditRichly0x100Context is richly editable.

This enum was introduced or modified in Qt 6.2.

The EditFlags type is a typedef for QFlags<EditFlag>. It stores an OR combination of EditFlag values.

[since 6.2] enum QWebEngineContextMenuRequest::MediaFlag
flags QWebEngineContextMenuRequest::MediaFlags

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

ConstantValueDescription
QWebEngineContextMenuRequest::MediaInError0x1An error occurred.
QWebEngineContextMenuRequest::MediaPaused0x2Media is paused.
QWebEngineContextMenuRequest::MediaMuted0x4Media is muted.
QWebEngineContextMenuRequest::MediaLoop0x8Media can be looped.
QWebEngineContextMenuRequest::MediaCanSave0x10Media can be saved.
QWebEngineContextMenuRequest::MediaHasAudio0x20Media has audio.
QWebEngineContextMenuRequest::MediaCanToggleControls0x40Media can show controls.
QWebEngineContextMenuRequest::MediaControls0x80Media controls are shown.
QWebEngineContextMenuRequest::MediaCanPrint0x100Media is printable.
QWebEngineContextMenuRequest::MediaCanRotate0x200Media is rotatable.

This enum was introduced or modified in Qt 6.2.

The MediaFlags type is a typedef for QFlags<MediaFlag>. It stores an OR combination of MediaFlag values.

[since 6.2] enum QWebEngineContextMenuRequest::MediaType

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

ConstantValueDescription
QWebEngineContextMenuRequest::MediaTypeNone0The context is not a media type.
QWebEngineContextMenuRequest::MediaTypeImage1The context is an image element.
QWebEngineContextMenuRequest::MediaTypeVideo2The context is a video element.
QWebEngineContextMenuRequest::MediaTypeAudio3The context is an audio element.
QWebEngineContextMenuRequest::MediaTypeCanvas4The context is a canvas element.
QWebEngineContextMenuRequest::MediaTypeFile5The context is a file.
QWebEngineContextMenuRequest::MediaTypePlugin6The context is a plugin element.

This enum was introduced or modified in Qt 6.2.

Property Documentation

accepted : bool

This property holds whether the request is accepted.

Access functions:

bool isAccepted() const
void setAccepted(bool accepted)

Member Function Documentation

[virtual] QWebEngineContextMenuRequest::~QWebEngineContextMenuRequest()

Destroys the context menu request.

QWebEngineContextMenuRequest::EditFlags QWebEngineContextMenuRequest::editFlags() const

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

Note: Getter function for property editFlags.

bool QWebEngineContextMenuRequest::isContentEditable() const

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

Note: Getter function for property isContentEditable.

QString QWebEngineContextMenuRequest::linkText() const

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

Note: Getter function for property linkText.

QUrl QWebEngineContextMenuRequest::linkUrl() const

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

Note: Getter function for property linkUrl.

QWebEngineContextMenuRequest::MediaFlags QWebEngineContextMenuRequest::mediaFlags() const

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

Note: Getter function for property mediaFlags.

QWebEngineContextMenuRequest::MediaType QWebEngineContextMenuRequest::mediaType() const

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

Note: Getter function for property mediaType.

QUrl QWebEngineContextMenuRequest::mediaUrl() const

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

Note: Getter function for property mediaUrl.

QString QWebEngineContextMenuRequest::misspelledWord() const

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().

Note: Getter function for property misspelledWord.

QPoint QWebEngineContextMenuRequest::position() const

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

Note: Getter function for property position.

QString QWebEngineContextMenuRequest::selectedText() const

Returns the selected text of the context menu request.

Note: Getter function for property selectedText.

QStringList QWebEngineContextMenuRequest::spellCheckerSuggestions() const

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

Note: Getter function for property spellCheckerSuggestions.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.