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 |
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 } |
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 |
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.
[since 6.2]
enum QWebEngineContextMenuRequest::EditFlagThe available edit operations in the current context menu request.
Constant | Value | Description |
---|---|---|
QWebEngineContextMenuRequest::CanUndo |
0x1 |
Undo is available. |
QWebEngineContextMenuRequest::CanRedo |
0x2 |
Redo is available. |
QWebEngineContextMenuRequest::CanCut |
0x4 |
Cut is available. |
QWebEngineContextMenuRequest::CanCopy |
0x8 |
Copy is available. |
QWebEngineContextMenuRequest::CanPaste |
0x10 |
Paste is available. |
QWebEngineContextMenuRequest::CanDelete |
0x20 |
Delete is available. |
QWebEngineContextMenuRequest::CanSelectAll |
0x40 |
Select All is available. |
QWebEngineContextMenuRequest::CanTranslate |
0x80 |
Translate is available. |
QWebEngineContextMenuRequest::CanEditRichly |
0x100 |
Context 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::MediaFlagThe current media element's status and its available operations. MediaNone
if the selected web page content is not a media element.
Constant | Value | Description |
---|---|---|
QWebEngineContextMenuRequest::MediaInError |
0x1 |
An error occurred. |
QWebEngineContextMenuRequest::MediaPaused |
0x2 |
Media is paused. |
QWebEngineContextMenuRequest::MediaMuted |
0x4 |
Media is muted. |
QWebEngineContextMenuRequest::MediaLoop |
0x8 |
Media can be looped. |
QWebEngineContextMenuRequest::MediaCanSave |
0x10 |
Media can be saved. |
QWebEngineContextMenuRequest::MediaHasAudio |
0x20 |
Media has audio. |
QWebEngineContextMenuRequest::MediaCanToggleControls |
0x40 |
Media can show controls. |
QWebEngineContextMenuRequest::MediaControls |
0x80 |
Media controls are shown. |
QWebEngineContextMenuRequest::MediaCanPrint |
0x100 |
Media is printable. |
QWebEngineContextMenuRequest::MediaCanRotate |
0x200 |
Media 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::MediaTypeThis enum describes the media type of the context menu request if any.
Constant | Value | Description |
---|---|---|
QWebEngineContextMenuRequest::MediaTypeNone |
0 |
The context is not a media type. |
QWebEngineContextMenuRequest::MediaTypeImage |
1 |
The context is an image element. |
QWebEngineContextMenuRequest::MediaTypeVideo |
2 |
The context is a video element. |
QWebEngineContextMenuRequest::MediaTypeAudio |
3 |
The context is an audio element. |
QWebEngineContextMenuRequest::MediaTypeCanvas |
4 |
The context is a canvas element. |
QWebEngineContextMenuRequest::MediaTypeFile |
5 |
The context is a file. |
QWebEngineContextMenuRequest::MediaTypePlugin |
6 |
The context is a plugin element. |
This enum was introduced or modified in Qt 6.2.
This property holds whether the request is accepted.
Access functions:
bool | isAccepted() const |
void | setAccepted(bool accepted) |
[virtual]
QWebEngineContextMenuRequest::~QWebEngineContextMenuRequest()Destroys the context menu request.
Returns the available edit operations in the current context or CanDoNone
if no actions are available.
Note: Getter function for property editFlags.
Returns true
if the context menu request is editable by the user; otherwise returns false
.
Note: Getter function for property isContentEditable.
Returns the text of a link if the context menu request was requested for a link.
Note: Getter function for property linkText.
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.
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.
Returns the type of the media element or MediaTypeNone
if the context menu requestis not a media element.
Note: Getter function for property mediaType.
If the context menu request is a media element, returns the URL of that media.
Note: Getter function for property mediaUrl.
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.
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.
Returns the selected text of the context menu request.
Note: Getter function for property selectedText.
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.