Qt 5.7 | Qt WebEngine | QML Types | WebEngineContextMenuData QML Type

Qt 5.7.1 Reference Documentation

# WebEngineContextMenuData QML Type

Provides context data for populating or extending a context menu with actions. More...

Import Statement: | import QtWebEngine 1.3
Since: | QtWebEngine 1.3

- List of all members, including inherited members

## Properties

- isContentEditable : bool
- isValid : bool
- linkText : string
- linkUrl : url
- mediaType : enumeration
- mediaUrl : url
- position : point
- selectedText : string

## Detailed Description

WebEngineContextMenuData is returned by WebEngineView::contextMenuData() 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 WebEngineView::WebAction will be performed.

## Property Documentation

isContentEditable : bool

Returns `true` if the content is editable by the user; otherwise returns `false`.

isValid : bool

Is `true` if the context data is valid; otherwise `false`.

linkText : string

Returns the text of a link if the context is a link.

linkUrl : url

Returns the URL of a link if the context is a link.

mediaType : enumeration

Returns the type of the media element or `MediaTypeNone` if the context is not a media element.

Constant | Description
--- | ---
`WebEngineContextMenuData.MediaTypeNone` | The context is not a media element.
`WebEngineContextMenuData.MediaTypeImage` | The context is an image element
`WebEngineContextMenuData.MediaTypeVideo` | The context is a video element
`WebEngineContextMenuData.MediaTypeAudio` | The context is an audio element
`WebEngineContextMenuData.MediaTypeCanvas` | The context is a canvas element
`WebEngineContextMenuData.MediaTypeFile` | The context is a file
`WebEngineContextMenuData.MediaTypePlugin` | The context is a plugin

mediaUrl : url

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

position : point

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

selectedText : string

Returns the selected text of the context.