A request for showing a context menu. 更多...
| import 語句: |
import QtWebEngine
|
| Since: | QtWebEngine 1.4 |
(since QtWebEngine 1.7)
(since QtWebEngine 1.7)
A ContextMenuRequest is passed as an argument of the WebEngineView::contextMenuRequested signal. It provides further information about the context of the request. The position property provides the origin of the request.
The accepted property of the request indicates whether the request is handled by the user code or the default context menu should be displayed.
The following code uses a custom menu to handle the request:
WebEngineView { id: view // ... onContextMenuRequested: function(request) { request.accepted = true; myMenu.x = request.x; myMenu.y = request.y; myMenu.trigger.connect(view.triggerWebAction); myMenu.popup(); } // ... }
|
accepted : bool |
Indicates whether the context menu request has been handled by the signal handler.
若特性為
false
after any signal handlers for
WebEngineView::contextMenuRequested
have been executed, a default context menu will be shown. To prevent this, set
request.accepted
to
true
.
默認為
false
.
注意: The default content of the context menu depends on the web element for which the request was actually generated.
|
editFlags
:
flags
|
The available edit operations in the current context or
CanDoNone
若沒有動作可用。
| 常量 | 描述 |
|---|---|
ContextMenuRequest.CanUndo
|
撤銷可用。 |
ContextMenuRequest.CanRedo
|
重做是可用的。 |
ContextMenuRequest.CanCut
|
剪切可用。 |
ContextMenuRequest.CanCopy
|
拷貝可用。 |
ContextMenuRequest.CanPaste
|
粘貼可用。 |
ContextMenuRequest.CanDelete
|
刪除可用。 |
ContextMenuRequest.CanSelectAll
|
選擇所有可用。 |
ContextMenuRequest.CanTranslate
|
翻譯可用。 |
ContextMenuRequest.CanEditRichly
|
上下文富可編輯。 |
該特性在 QtWebEngine 1.7 引入。
|
isContentEditable
:
bool
|
Indicates whether the selected web content is editable.
|
linkText
:
string
|
The text of the link, if the context menu was requested for a link.
|
linkUrl
:
url
|
The URL of the link, if the selected web page content is a link. It is not guaranteed to be a valid URL.
|
mediaFlags
:
flags
|
當前媒體元素的狀態及其可用操作。
MediaNone
若選中網頁內容不是媒體元素。
| 常量 | 描述 |
|---|---|
ContextMenuRequest.MediaInError
|
齣現錯誤。 |
ContextMenuRequest.MediaPaused
|
媒體被暫停。 |
ContextMenuRequest.MediaMuted
|
媒體被靜音。 |
ContextMenuRequest.MediaLoop
|
媒體可以循環。 |
ContextMenuRequest.MediaCanSave
|
媒體可以被保存。 |
ContextMenuRequest.MediaHasAudio
|
媒體有音頻。 |
ContextMenuRequest.MediaCanToggleControls
|
媒體可以展示控件。 |
ContextMenuRequest.MediaControls
|
媒體控件被展示。 |
ContextMenuRequest.MediaCanPrint
|
媒體可打印。 |
ContextMenuRequest.MediaCanRotate
|
媒體可鏇轉。 |
該特性在 QtWebEngine 1.7 引入。
|
mediaType
:
enumeration
|
The type of the media element, or
MediaTypeNone
若選中網頁內容不是媒體元素。
| 常量 | 描述 |
|---|---|
ContextMenuRequest.MediaTypeNone
|
Not a media. |
ContextMenuRequest.MediaTypeImage
|
An image. |
ContextMenuRequest.MediaTypeVideo
|
A video. |
ContextMenuRequest.MediaTypeAudio
|
An audio element. |
ContextMenuRequest.MediaTypeCanvas
|
A canvas. |
ContextMenuRequest.MediaTypeFile
|
A file. |
ContextMenuRequest.MediaTypePlugin
|
A plugin. |
|
mediaUrl
:
url
|
The URL of media, if the selected web content is a media element.
|
misspelledWord
:
string
|
若上下文是由拼寫檢查器認為的拼寫錯誤單詞,返迴拼寫錯誤單詞。
|
位置
:
point
|
The position of the user action from where the context menu request originates.
|
selectedText
:
string
|
The selected text the context menu was created for.
|
spellCheckerSuggestions
:
stringlist
|
If the context is a word considered misspelled by the spell-checker, returns a list of suggested replacements.