QWebEngineSettings 類提供對象以存儲設置,用於 QWebEnginePage . 更多...
| 頭: |
#include <QWebEngineSettings>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
|
| qmake: |
QT += webenginecore
|
| enum | FontFamily { StandardFont, FixedFont, SerifFont, SansSerifFont, CursiveFont, …, PictographFont } |
| enum | FontSize { MinimumFontSize, MinimumLogicalFontSize, DefaultFontSize, DefaultFixedFontSize } |
(since Qt 6.8)
枚舉類
|
ImageAnimationPolicy { Allow, AnimateOnce, Disallow } |
(since Qt 5.11)
enum
|
UnknownUrlSchemePolicy { DisallowUnknownUrlSchemes, AllowUnknownUrlSchemesFromUserInteraction, AllowAllUnknownUrlSchemes } |
| enum | WebAttribute { AutoLoadImages, JavascriptEnabled, JavascriptCanOpenWindows, JavascriptCanAccessClipboard, LinksIncludedInFocusChain, …, ForceDarkMode } |
| QString | defaultTextEncoding () const |
| QString | fontFamily (QWebEngineSettings::FontFamily which ) const |
| int | fontSize (QWebEngineSettings::FontSize type ) const |
(since Qt 6.8)
QWebEngineSettings::ImageAnimationPolicy
|
imageAnimationPolicy () const |
| void | resetAttribute (QWebEngineSettings::WebAttribute attribute ) |
| void | resetFontFamily (QWebEngineSettings::FontFamily which ) |
| void | resetFontSize (QWebEngineSettings::FontSize type ) |
(since Qt 6.8)
void
|
resetImageAnimationPolicy () |
(since Qt 5.11)
void
|
resetUnknownUrlSchemePolicy () |
| void | setAttribute (QWebEngineSettings::WebAttribute attribute , bool on ) |
| void | setDefaultTextEncoding (const QString & encoding ) |
| void | setFontSize (QWebEngineSettings::FontSize type , int size ) |
(since Qt 6.8)
void
|
setImageAnimationPolicy (QWebEngineSettings::ImageAnimationPolicy policy ) |
(since Qt 5.11)
void
|
setUnknownUrlSchemePolicy (QWebEngineSettings::UnknownUrlSchemePolicy policy ) |
| bool | testAttribute (QWebEngineSettings::WebAttribute attribute ) const |
(since Qt 5.11)
QWebEngineSettings::UnknownUrlSchemePolicy
|
unknownUrlSchemePolicy () const |
QWebEngineSettings allows configuration of browser properties, such as font sizes and families, and generic attributes, such as JavaScript support. Individual attributes are set using the setAttribute () 函數。 WebAttribute 枚舉進一步描述各屬性。
每個 QWebEnginePage 對象有它自己的 qwebengineessettings 對象 (為該頁麵配置設置)。若尚未為 Web 引擎頁麵配置設置,將在頁麵所屬 Profile (配置文件) 設置中查找它。
另請參閱 QWebEnginePage::settings () 和 QWebEngineView::settings ().
此枚舉描述由 CSS 2 定義的一般字體係列。更多信息見 CSS 標準 .
| 常量 | 值 | 描述 |
|---|---|---|
QWebEngineSettings::StandardFont
|
0
|
|
QWebEngineSettings::FixedFont
|
1
|
|
QWebEngineSettings::SerifFont
|
2
|
|
QWebEngineSettings::SansSerifFont
|
3
|
|
QWebEngineSettings::CursiveFont
|
4
|
|
QWebEngineSettings::FantasyFont
|
5
|
|
QWebEngineSettings::PictographFont
|
6
|
(added in Qt 5.7, deprecated Qt 6.4) |
此枚舉描述字體大小, 可配置透過 QWebEngineSettings :
| 常量 | 值 | 描述 |
|---|---|---|
QWebEngineSettings::MinimumFontSize
|
0
|
硬最小字體大小。 |
QWebEngineSettings::MinimumLogicalFontSize
|
1
|
當縮小時應用的最小邏輯字體大小。 |
QWebEngineSettings::DefaultFontSize
|
2
|
用於常規文本的默認字體大小。 |
QWebEngineSettings::DefaultFixedFontSize
|
3
|
用於固定間距文本的默認字體大小。 |
[since Qt 6.8]
enum class QWebEngineSettings::
ImageAnimationPolicy
This enum describes how an image animation should be handled when the image frames are rendered for animation.
| 常量 | 值 | 描述 |
|---|---|---|
QWebEngineSettings::ImageAnimationPolicy::Allow
|
1
|
Allows image animation when the image frames are rendered. |
QWebEngineSettings::ImageAnimationPolicy::AnimateOnce
|
2
|
Animate the image once when the image frames are rendered. |
QWebEngineSettings::ImageAnimationPolicy::Disallow
|
3
|
Disallows image animation when the image frames are rendered. |
該枚舉在 Qt 6.8 引入。
另請參閱 imageAnimationPolicy , setImageAnimationPolicy ,和 resetImageAnimationPolicy .
[since Qt 5.11]
enum QWebEngineSettings::
UnknownUrlSchemePolicy
此枚舉描述如何處理具有未知方案的 URL 導航請求。
| 常量 | 值 | 描述 |
|---|---|---|
QWebEngineSettings::DisallowUnknownUrlSchemes
|
1
|
禁止所有具有未知方案的 URL 導航請求。 |
QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction
|
2
|
Allows navigation requests to URLs with unknown schemes that are issued from user-interaction (like a mouse-click), whereas other navigation requests (for example from JavaScript) are suppressed. |
QWebEngineSettings::AllowAllUnknownUrlSchemes
|
3
|
Allows all navigation requests to URLs with unknown schemes. |
該枚舉在 Qt 5.11 引入。
另請參閱 unknownUrlSchemePolicy , setUnknownUrlSchemePolicy ,和 resetUnknownUrlSchemePolicy .
此枚舉類型指定網頁設置:
| 常量 | 值 | 描述 |
|---|---|---|
QWebEngineSettings::AutoLoadImages
|
0
|
自動下載網頁圖像。當禁用此設置時,將從緩存加載圖像。默認啓用。 |
QWebEngineSettings::JavascriptEnabled
|
1
|
使 JavaScript 程序能夠運行在 MainWorld 。默認啓用。 |
QWebEngineSettings::JavascriptCanOpenWindows
|
2
|
允許 JavaScript 程序打開彈齣窗口 (無需用戶交互)。默認啓用。 |
QWebEngineSettings::JavascriptCanAccessClipboard
|
3
|
Allows JavaScript programs to write (copy) sanitized content to the clipboard. A sanitized write is done with the
write
and
writeText
JavaScript Clipboard API calls and must be accompanied by user action. Unsanitized writes, and reading from the clipboard, are enabled by JavascriptCanPaste. Prior to Chromium version 81, this setting enabled all clipboard writes. Since unrestricted clipboard access is a potential security concern, it is recommended that applications leave this disabled and instead respond to
ClipboardReadWrite
feature permission requests. Disabled by default.
|
QWebEngineSettings::LinksIncludedInFocusChain
|
4
|
包括鍵盤聚焦鏈中的超鏈接。默認啓用。 |
QWebEngineSettings::LocalStorageEnabled
|
5
|
啓用支持 HTML 5 本地存儲特徵。默認啓用。 |
QWebEngineSettings::LocalContentCanAccessRemoteUrls
|
6
|
Allows local origin documents to access remote resources that would normally be blocked. Disabled by default. Note DnsPrefetchEnabled below operates independently of this setting, and can if enabled, cause remote accesses from local content. |
QWebEngineSettings::XSSAuditingEnabled
|
7
|
過時且不起作用。 |
QWebEngineSettings::SpatialNavigationEnabled
|
8
|
啓用空間導航特徵,這意味著能夠通過使用左、右、上、下箭頭鍵在網頁可聚焦元素 (譬如:超鏈接和錶單控件) 之間導航。例如,若用戶按下右箭頭鍵,試探確定是否試著朝右有可能到達的元素,及它們可能想要到達哪個元素。默認禁用。 |
QWebEngineSettings::LocalContentCanAccessFileUrls
|
9
|
Allows locally loaded documents to access other local URLs. Disabling this makes QtWebEngine behave more like Chrome and Firefox does by default. Enabled by default. |
QWebEngineSettings::HyperlinkAuditingEnabled
|
10
|
啓用支持
ping
屬性為超鏈接。默認禁用。
|
QWebEngineSettings::ScrollAnimatorEnabled
|
11
|
啓用動畫捲動。默認禁用。 |
QWebEngineSettings::ErrorPageEnabled
|
12
|
啓用顯示 Chromium 的內置錯誤頁麵。默認啓用。 |
QWebEngineSettings::PluginsEnabled
|
13
|
Enables support for Pepper plugins, such as the Flash player. Disabled by default. |
QWebEngineSettings::FullScreenSupportEnabled
|
14
|
在應用程序中啓用全屏支持。默認禁用 (在 Qt 5.6 添加)。 |
QWebEngineSettings::ScreenCaptureEnabled
|
15
|
在應用程序中啓用屏幕捕獲。默認禁用 (在 Qt 5.7 添加)。 |
QWebEngineSettings::WebGLEnabled
|
16
|
啓用支持 HTML 5 WebGL。默認啓用,若可用 (在 Qt 5.7 添加)。 |
QWebEngineSettings::Accelerated2dCanvasEnabled
|
17
|
指定 HTML5 2D 畫布是否應該是 OpenGL 幀緩衝。這使很多描繪操作變得更快,但會減慢像素訪問。默認啓用,若可用 (在 Qt 5.7 添加)。 |
QWebEngineSettings::AutoLoadIconsForPage
|
18
|
自動下載網頁圖標。默認啓用 (在 Qt 5.7 添加)。 |
QWebEngineSettings::TouchIconsEnabled
|
19
|
啓用支持觸摸圖標和預閤成觸摸圖標。默認禁用 (在 Qt 5.7 添加)。 |
QWebEngineSettings::FocusOnNavigationEnabled
|
20
|
將聚焦賦予頁麵關聯的視圖,每當發生導航操作時 (加載、停止、重新加載、重新加載和繞過緩存、前進、後退、設置內容、等)。默認禁用 (在 Qt 5.8 添加)。 |
QWebEngineSettings::PrintElementBackgrounds
|
21
|
打開 CSS 背景的打印,當打印網頁時。默認啓用 (在 Qt 5.8 添加)。 |
QWebEngineSettings::AllowRunningInsecureContent
|
22
|
默認情況下,HTTPS 頁麵無法從 HTTP URL 運行 JavaScript、CSS、插件或 Web 套接字。這提供覆寫以獲得舊的不安全行為。默認禁用 (在 Qt 5.8 添加)。 |
QWebEngineSettings::AllowGeolocationOnInsecureOrigins
|
23
|
從 Qt 5.7 起,僅安全源 (譬如 HTTPS) 能夠請求地理位置特徵。這提供覆寫以允許非安全源能再次訪問地理位置。默認禁用 (在 Qt 5.9 添加)。 |
QWebEngineSettings::AllowWindowActivationFromJavaScript
|
24
|
允許通過使用 window.focus() JavaScript 方法激活窗口。默認禁用 (在 Qt 5.10 添加)。 |
QWebEngineSettings::ShowScrollBars
|
25
|
展示滾動條。默認啓用 (在 Qt 5.10 添加)。 |
QWebEngineSettings::PlaybackRequiresUserGesture
|
26
|
禁止媒體內容迴放,直到用戶與頁麵交互。默認情況下, WebEngine 使用 Chromium 設置,作為描述在 自動播放策略變化 。這與 Chrome 在 Android 中的行為類似,而禁用它時的默認行為與桌麵 Chrome 類似。要覆寫默認行為,禁用此設置 (在 Qt 5.11 添加)。 |
QWebEngineSettings::JavascriptCanPaste
|
28
|
Allows JavaScript programs to read (paste) from the clipboard and to write unsanitized content. A sanitized write is done with the
write
and
writeText
JavaScript Clipboard API calls and must be accompanied by user action; unsanitized writes are any writes which do not meet these criteria. For this setting to have any effect, JavascriptCanAccessClipboard must also be enabled. Since unrestricted clipboard access is a potential security concern, it is recommended that applications leave this disabled and instead respond to
ClipboardReadWrite
feature permission requests. Disabled by default. (Added in Qt 5.11)
|
QWebEngineSettings::WebRTCPublicInterfacesOnly
|
27
|
Limits WebRTC to public IP addresses only. When disabled WebRTC may also use local network IP addresses, but remote hosts can also see your local network IP address. Disabled by default. (Added in Qt 5.11) |
QWebEngineSettings::DnsPrefetchEnabled
|
29
|
指定是否 WebEngine 將試著預抓取 DNS 條目以加速瀏覽。默認禁用 (在 Qt 5.12 添加)。 |
QWebEngineSettings::PdfViewerEnabled
|
30
|
指定 PDF 文檔將在內部 PDF 查看器中打開而不是下載。默認啓用 (在 Qt 5.13 添加)。 |
QWebEngineSettings::NavigateOnDropEnabled
|
31
|
Specifies that navigations can be triggered by dropping URLs on the view. Enabled by default. (Added in Qt 6.4) |
QWebEngineSettings::ReadingFromCanvasEnabled
|
32
|
Specifies that reading from all canvas elements is enabled. This setting will have impact on all HTML5 canvas elements irrespective of origin, and can be disabled to prevent canvas fingerprinting. Enabled by default. (Added in Qt 6.6) |
QWebEngineSettings::ForceDarkMode
|
33
|
Specifies that all web contents will be rendered using a dark theme. For more information, see Auto dark theme . Disabled by default. (Added in Qt 6.7) |
返迴默認文本編碼。
另請參閱 setDefaultTextEncoding ().
Returns the actual font family for the specified generic font family, which .
返迴默認字體大小對於 type (以像素為單位)。
另請參閱 setFontSize ().
[since Qt 6.8]
QWebEngineSettings::ImageAnimationPolicy
QWebEngineSettings::
imageAnimationPolicy
() const
Returns the currently selected policy for handling image animation when the image frames are rendered. Default is QWebEngineSettings::ImageAnimationPolicy::Allow .
該函數在 Qt 6.8 引入。
另請參閱 setImageAnimationPolicy and resetImageAnimationPolicy .
Resets the setting of attribute to the value specified in the profile that the page belongs to.
Resets the actual font family specified by which to the one specified in the profile that the page belongs to.
Resets the font size for type to the size specified in the profile that the page belongs to.
[since Qt 6.8]
void
QWebEngineSettings::
resetImageAnimationPolicy
()
Removes the policy for handling image animation.
該函數在 Qt 6.8 引入。
另請參閱 imageAnimationPolicy and setImageAnimationPolicy .
[since Qt 5.11]
void
QWebEngineSettings::
resetUnknownUrlSchemePolicy
()
Removes the policy for handling navigation requests to URLs with unknown schemes.
該函數在 Qt 5.11 引入。
另請參閱 unknownUrlSchemePolicy and setUnknownUrlSchemePolicy .
啓用或禁用指定 attribute 特徵從屬值對於 on .
指定默認文本編碼係統。
值 encoding must be a string describing an encoding such as "utf-8" or "iso-8859-1". If left empty, a default value will be used. For a more extensive list of encoding names see QTextCodec .
另請參閱 defaultTextEncoding ().
設置字體大小對於 type to size (以像素為單位)。
另請參閱 fontSize ().
[since Qt 6.8]
void
QWebEngineSettings::
setImageAnimationPolicy
(
QWebEngineSettings::ImageAnimationPolicy
policy
)
Sets the policy for handling image animation when the image frames are rendered to policy 。默認為 QWebEngineSettings::ImageAnimationPolicy::Allow .
該函數在 Qt 6.8 引入。
另請參閱 imageAnimationPolicy and resetImageAnimationPolicy .
[since Qt 5.11]
void
QWebEngineSettings::
setUnknownUrlSchemePolicy
(
QWebEngineSettings::UnknownUrlSchemePolicy
policy
)
將未知方案 URL 的導航請求處理策略設為 policy 。默認為 QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction .
該函數在 Qt 5.11 引入。
另請參閱 unknownUrlSchemePolicy and resetUnknownUrlSchemePolicy .
返迴
true
if
attribute
被啓用;否則返迴
false
.
[since Qt 5.11]
QWebEngineSettings::UnknownUrlSchemePolicy
QWebEngineSettings::
unknownUrlSchemePolicy
() const
Returns the currently selected policy for handling navigation requests to URLs with unknown schemes. Default is QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction .
該函數在 Qt 5.11 引入。
另請參閱 setUnknownUrlSchemePolicy and resetUnknownUrlSchemePolicy .