QWebEngineContextMenuData Class

The QWebEngineContextMenuData class provides context data for populating or extending a context menu with actions. More...

Header: #include <QWebEngineContextMenuData>
qmake: QT += webenginewidgets
Since: Qt 5.7

Public Types

enum MediaType { MediaTypeNone, MediaTypeImage, MediaTypeVideo, MediaTypeAudio, ..., MediaTypePlugin }

Public Functions

QWebEngineContextMenuData(const QWebEngineContextMenuData &other)
bool isContentEditable() const
bool isValid() const
QString linkText() const
QUrl linkUrl() const
MediaType mediaType() const
QUrl mediaUrl() const
QPoint position() const
QString selectedText() const
QWebEngineContextMenuData &operator=(const QWebEngineContextMenuData &other)

Detailed Description

The QWebEngineContextMenuData class provides context data for populating or extending a context menu with actions.

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

Member Type Documentation

enum QWebEngineContextMenuData::MediaType

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

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

Member Function Documentation


Constructs null context menu data.

QWebEngineContextMenuData::QWebEngineContextMenuData(const QWebEngineContextMenuData &other)

Constructs context menu data from other.


Destroys the context menu data.

bool QWebEngineContextMenuData::isContentEditable() const

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

bool QWebEngineContextMenuData::isValid() const

Returns true if the context data is valid; otherwise returns false.

QString QWebEngineContextMenuData::linkText() const

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

QUrl QWebEngineContextMenuData::linkUrl() const

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

MediaType QWebEngineContextMenuData::mediaType() const

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

QUrl QWebEngineContextMenuData::mediaUrl() const

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

QPoint QWebEngineContextMenuData::position() const

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

QString QWebEngineContextMenuData::selectedText() const

Returns the selected text of the context.

QWebEngineContextMenuData &QWebEngineContextMenuData::operator=(const QWebEngineContextMenuData &other)

Assigns the other context menu data to this.

© 2016 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.