QWebEngineContextMenuRequest Class

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

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

公共类型

(从 6.2 起) enum EditFlag { CanUndo, CanRedo, CanCut, CanCopy, CanPaste, …, CanEditRichly }
flags EditFlags
(从 6.2 起) enum MediaFlag { MediaInError, MediaPaused, MediaMuted, MediaLoop, MediaCanSave, …, MediaCanRotate }
flags MediaFlags
(从 6.2 起) 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 () 在上下文菜单事件之后,且包含上下文菜单事件发生位置的有关信息。这也在上下文中,在任何上下文特定 QWebEnginePage::WebAction 将被履行。

成员类型文档编制

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

The available edit operations in the current context menu request.

常量 描述
QWebEngineContextMenuRequest::CanUndo 0x1 撤销可用。
QWebEngineContextMenuRequest::CanRedo 0x2 重做是可用的。
QWebEngineContextMenuRequest::CanCut 0x4 剪切可用。
QWebEngineContextMenuRequest::CanCopy 0x8 拷贝可用。
QWebEngineContextMenuRequest::CanPaste 0x10 粘贴可用。
QWebEngineContextMenuRequest::CanDelete 0x20 删除可用。
QWebEngineContextMenuRequest::CanSelectAll 0x40 选择所有可用。
QWebEngineContextMenuRequest::CanTranslate 0x80 翻译可用。
QWebEngineContextMenuRequest::CanEditRichly 0x100 上下文富可编辑。

该枚举在 Qt 6.2 引入。

EditFlags 类型是 typedef 对于 QFlags <EditFlag>。它存储 EditFlag 值的 OR 组合。

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

当前媒体元素的状态及其可用操作。 MediaNone 若选中网页内容不是媒体元素。

常量 描述
QWebEngineContextMenuRequest::MediaInError 0x1 出现错误。
QWebEngineContextMenuRequest::MediaPaused 0x2 媒体被暂停。
QWebEngineContextMenuRequest::MediaMuted 0x4 媒体被静音。
QWebEngineContextMenuRequest::MediaLoop 0x8 媒体可以循环。
QWebEngineContextMenuRequest::MediaCanSave 0x10 媒体可以被保存。
QWebEngineContextMenuRequest::MediaHasAudio 0x20 媒体有音频。
QWebEngineContextMenuRequest::MediaCanToggleControls 0x40 媒体可以展示控件。
QWebEngineContextMenuRequest::MediaControls 0x80 媒体控件被展示。
QWebEngineContextMenuRequest::MediaCanPrint 0x100 媒体可打印。
QWebEngineContextMenuRequest::MediaCanRotate 0x200 媒体可旋转。

该枚举在 Qt 6.2 引入。

MediaFlags 类型是 typedef 对于 QFlags <MediaFlag>。它存储 MediaFlag 值的 OR 组合。

[since 6.2] enum QWebEngineContextMenuRequest:: MediaType

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

常量 描述
QWebEngineContextMenuRequest::MediaTypeNone 0 上下文不是媒体类型。
QWebEngineContextMenuRequest::MediaTypeImage 1 上下文是图像元素。
QWebEngineContextMenuRequest::MediaTypeVideo 2 上下文是视频元素。
QWebEngineContextMenuRequest::MediaTypeAudio 3 上下文是音频元素。
QWebEngineContextMenuRequest::MediaTypeCanvas 4 上下文是画布元素。
QWebEngineContextMenuRequest::MediaTypeFile 5 上下文是文件。
QWebEngineContextMenuRequest::MediaTypePlugin 6 上下文是插件元素。

该枚举在 Qt 6.2 引入。

特性文档编制

accepted : bool

This property holds whether the request is accepted.

访问函数:

bool isAccepted () const
void setAccepted (bool accepted )

成员函数文档编制

[virtual noexcept] QWebEngineContextMenuRequest:: ~QWebEngineContextMenuRequest ()

Destroys the context menu request.

QWebEngineContextMenuRequest::EditFlags QWebEngineContextMenuRequest:: editFlags () const

返回在当前上下文中的可用编辑操作,或 CanDoNone 如果没有动作可用。

注意: Getter function for property editFlags.

bool QWebEngineContextMenuRequest:: isContentEditable () const

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

注意: 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.

注意: 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.

注意: Getter function for property linkUrl.

QWebEngineContextMenuRequest::MediaFlags QWebEngineContextMenuRequest:: mediaFlags () const

返回当前媒体元素的状态及其可用操作。 MediaNone 若选中网页内容不是媒体元素。

注意: Getter function for property mediaFlags.

QWebEngineContextMenuRequest::MediaType QWebEngineContextMenuRequest:: mediaType () const

返回媒体元素的类型,或 MediaTypeNone if the context menu requestis not a media element.

注意: Getter function for property mediaType.

QUrl QWebEngineContextMenuRequest:: mediaUrl () const

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

注意: 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.

有关单词的可能置换,见 spellCheckerSuggestions ().

注意: 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.

注意: getter 函数对于特性 position。

QString QWebEngineContextMenuRequest:: selectedText () const

Returns the selected text of the context menu request.

注意: 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 ().

注意: Getter function for property spellCheckerSuggestions.