QCefView
|
Represents the CEF browser view. More...
#include <QCefView.h>
Public Types | |
enum | CefWindowOpenDisposition |
Represents the CEF pop-up windows open disposition. More... | |
Public Slots | |
void | setFocus () |
Signals | |
void | loadingStateChanged (const int &browserId, bool isLoading, bool canGoBack, bool canGoForward) |
Gets called on loading state changed. | |
void | loadStart (const int &browserId, const QString &frameId, bool isMainFrame, int transitionType) |
Gets called on loading starts. | |
void | loadEnd (const int &browserId, const QString &frameId, bool isMainFrame, int httpStatusCode) |
Gets called on loading ends. | |
void | loadError (const int &browserId, const QString &frameId, bool isMainFrame, int errorCode, const QString &errorMsg, const QString &failedUrl) |
Gets called on loading failed due to error. | |
void | draggableRegionChanged (const QRegion &draggableRegion, const QRegion &nonDraggableRegion) |
Gets called on draggable region changed. | |
void | addressChanged (const QString &frameId, const QString &url) |
Gets called on the address changed. | |
void | titleChanged (const QString &title) |
Gets called on title changed. | |
void | faviconURLChanged (const QStringList &urls) |
Gets called on favicon url changed. | |
void | fullscreenModeChanged (bool fullscreen) |
Gets called on fullscreen mode changed. | |
void | statusMessage (const QString &message) |
Gets called on status message changed. | |
void | consoleMessage (const QString &message, int level) |
Gets called on console message from the web content. | |
void | loadingProgressChanged (double progress) |
Gets called on loading progress changed. | |
void | cefUrlRequest (const int &browserId, const QString &frameId, const QString &url) |
Gets called on built-in scheme URL access. | |
void | cefQueryRequest (const int &browserId, const QString &frameId, const QCefQuery &query) |
Gets called on new QCefQuery request. | |
void | invokeMethod (const int &browserId, const QString &frameId, const QString &method, const QVariantList &arguments) |
Gets called on invoking method request from web content(Javascript) | |
void | reportJavascriptResult (const int &browserId, const QString &frameId, const QString &context, const QVariant &result) |
Gets called on the result of the javascript executed with executeJavascriptWithResult returned. | |
void | nativeBrowserCreated (QWindow *window) |
Gets called after the native browser window created. This slot does not work for OSR mode. | |
Public Member Functions | |
QCefView (const QString &url, const QCefSetting *setting, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
Constructs a QCefView instance. | |
QCefView (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) | |
Constructs a QCefView instance. | |
~QCefView () | |
Destructs the QCefView instance. | |
void | addLocalFolderResource (const QString &path, const QString &url, int priority=0) |
Adds a url mapping item with local web resource directory. | |
void | addArchiveResource (const QString &path, const QString &url, const QString &password="", int priority=0) |
Adds a url mapping item with local archive (.zip) file which contains the web resource. | |
int | browserId () |
Gets the browser id. | |
void | navigateToString (const QString &content) |
Navigates to the content. | |
void | navigateToUrl (const QString &url) |
Navigates to the URL. | |
bool | browserCanGoBack () |
Checks whether the browser can go back. | |
bool | browserCanGoForward () |
Checks whether the browser can go forward. | |
void | browserGoBack () |
Requires the browser to go back. | |
void | browserGoForward () |
Requires the browser to go forward. | |
bool | browserIsLoading () |
Checks whether the browser is loading. | |
void | browserReload () |
Requires the browser to reload. | |
void | browserStopLoad () |
Requires the browser to stop load. | |
bool | triggerEvent (const QCefEvent &event) |
Triggers the event for main frame. | |
bool | triggerEvent (const QCefEvent &event, const QString &frameId) |
Triggers the event for specified frame. | |
bool | broadcastEvent (const QCefEvent &event) |
Broad cast the event for all frames. | |
bool | responseQCefQuery (const QCefQuery &query) |
Response the QCefQuery request. | |
bool | executeJavascript (const QString &frameId, const QString &code, const QString &url) |
Executes javascript code in specified frame, this method does not report the result of the javascript. To get the result of the javascript execution use executeJavascriptWithResult | |
bool | executeJavascriptWithResult (const QString &frameId, const QString &code, const QString &url, const QString &context) |
Executes javascript code in specified frame and the result will be reported through reportJavascriptResult signal. | |
bool | setPreference (const QString &name, const QVariant &value, const QString &error) |
Sets the preference for this browser. | |
void | setOSRFrameRate (int fps) |
Sets the frame rate for OSR (Off-Screen Rendering). | |
bool | hasDevTools () |
Detects whether this browser has a devtools opened. | |
void | showDevTools () |
Opens the devtools dialog. | |
void | closeDevTools () |
Closes the devtools dialog. | |
void | setAllowDrag (bool allow) |
Sets whether dragging is allowed. | |
bool | allowDrag () const |
Indicates whether drag operations are allowed. | |
void | setFocus (Qt::FocusReason reason) |
Please refer to QWidget::setFocus. | |
QVariant | inputMethodQuery (Qt::InputMethodQuery query) const override |
Please refer to QWidget::inputMethodQuery. | |
Static Public Attributes | |
static const QString | MainFrameID |
The main frame identity. | |
static const QString | AllFrameID |
The identifier for all frames. | |
Protected Member Functions | |
virtual QCefView * | onNewBrowser (const QString &sourceFrameId, const QString &url, const QString &name, QCefView::CefWindowOpenDisposition targetDisposition, QRect &rect, QCefSetting &settings) |
Gets called before a new browser created (only for browser created by non-JavaScript) | |
virtual bool | onNewPopup (const QString &frameId, const QString &targetUrl, QString &targetFrameName, QCefView::CefWindowOpenDisposition targetDisposition, QRect &rect, QCefSetting &settings, bool &disableJavascriptAccess) |
Gets called before the popup browser created (only for browser created by JavaScript) | |
virtual void | onNewDownloadItem (const QSharedPointer< QCefDownloadItem > &item, const QString &suggestedName) |
Gets called on new download item was required. Keep reference to the download item and call QCefDownloadItem::start method to allow and start the download, Ignore the download item to disallow the download. | |
virtual void | onUpdateDownloadItem (const QSharedPointer< QCefDownloadItem > &item) |
Gets called on download item updated. To get this method called QCefDownloadItem::start method must be called in newDownloadItem method. | |
virtual bool | onRequestCloseFromWeb () |
Gets called on close request from web. | |
QPaintEngine * | paintEngine () const override |
Please refer to QWidget::paintEngine. | |
bool | event (QEvent *event) override |
Represents the CEF browser view.
Represents the CEF pop-up windows open disposition.
QCefView::QCefView | ( | const QString & | url, |
const QCefSetting * | setting, | ||
QWidget * | parent = nullptr, | ||
Qt::WindowFlags | f = Qt::WindowFlags() ) |
Constructs a QCefView instance.
url | The target url |
setting | The QCefSetting instance |
parent | The parent |
f | The Qt WindowFlags |
QCefView::QCefView | ( | QWidget * | parent = nullptr, |
Qt::WindowFlags | f = Qt::WindowFlags() ) |
Constructs a QCefView instance.
parent | The parent |
f | The Qt WindowFlags |
QCefView::~QCefView | ( | ) |
Destructs the QCefView instance.
void QCefView::addLocalFolderResource | ( | const QString & | path, |
const QString & | url, | ||
int | priority = 0 ) |
Adds a url mapping item with local web resource directory.
path | The path to the local resource directory |
url | The url to be mapped to |
priority | The priority |
void QCefView::addArchiveResource | ( | const QString & | path, |
const QString & | url, | ||
const QString & | password = "", | ||
int | priority = 0 ) |
Adds a url mapping item with local archive (.zip) file which contains the web resource.
path | The path to the local archive file |
url | The url to be mapped to |
password | The password of the archive |
priority | The priority |
int QCefView::browserId | ( | ) |
Gets the browser id.
void QCefView::navigateToString | ( | const QString & | content | ) |
Navigates to the content.
content | The content |
void QCefView::navigateToUrl | ( | const QString & | url | ) |
Navigates to the URL.
url | The url |
bool QCefView::browserCanGoBack | ( | ) |
Checks whether the browser can go back.
bool QCefView::browserCanGoForward | ( | ) |
Checks whether the browser can go forward.
void QCefView::browserGoBack | ( | ) |
Requires the browser to go back.
void QCefView::browserGoForward | ( | ) |
Requires the browser to go forward.
bool QCefView::browserIsLoading | ( | ) |
Checks whether the browser is loading.
void QCefView::browserReload | ( | ) |
Requires the browser to reload.
void QCefView::browserStopLoad | ( | ) |
Requires the browser to stop load.
bool QCefView::triggerEvent | ( | const QCefEvent & | event | ) |
Triggers the event for main frame.
event | The QCefEvent instance |
bool QCefView::triggerEvent | ( | const QCefEvent & | event, |
const QString & | frameId ) |
Triggers the event for specified frame.
event | The QCefEvent instance |
frameId | The frame id |
bool QCefView::broadcastEvent | ( | const QCefEvent & | event | ) |
Broad cast the event for all frames.
event | The QCefEvent instance |
bool QCefView::responseQCefQuery | ( | const QCefQuery & | query | ) |
Response the QCefQuery request.
query | The query instance |
bool QCefView::executeJavascript | ( | const QString & | frameId, |
const QString & | code, | ||
const QString & | url ) |
Executes javascript code in specified frame, this method does not report the result of the javascript. To get the result of the javascript execution use executeJavascriptWithResult
frameId | The frame id |
code | The javascript code |
url | The URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error |
bool QCefView::executeJavascriptWithResult | ( | const QString & | frameId, |
const QString & | code, | ||
const QString & | url, | ||
const QString & | context ) |
Executes javascript code in specified frame and the result will be reported through reportJavascriptResult signal.
frameId | The frame id |
code | The javascript code |
url | The URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error |
context | The context used to identify the one execution |
bool QCefView::setPreference | ( | const QString & | name, |
const QVariant & | value, | ||
const QString & | error ) |
Sets the preference for this browser.
name | The preference name |
value | The preference value, if this value is QVariant::UnknownType or QVariant::Invalid, the preference will be restored to default value |
error | The error message populated on failure |
void QCefView::setOSRFrameRate | ( | int | fps | ) |
Sets the frame rate for OSR (Off-Screen Rendering).
fps | The desired frame rate in frames per second. |
bool QCefView::hasDevTools | ( | ) |
Detects whether this browser has a devtools opened.
void QCefView::showDevTools | ( | ) |
Opens the devtools dialog.
void QCefView::closeDevTools | ( | ) |
Closes the devtools dialog.
void QCefView::setAllowDrag | ( | bool | allow | ) |
Sets whether dragging is allowed.
allow | True to allow dragging; false to disable it. |
bool QCefView::allowDrag | ( | ) | const |
Indicates whether drag operations are allowed.
|
signal |
Gets called on loading state changed.
browserId | Indicates the browser id |
isLoading | Indicates the browser is loading |
canGoBack | Indicates the browser can go back |
canGoForward | Indicates the browser can go forward |
|
signal |
Gets called on loading starts.
browserId | Indicates the browser id |
frameId | Indicates the frame id |
isMainFrame | Indicates the whether this is the main frame |
transitionType | transition type |
|
signal |
Gets called on loading ends.
browserId | Indicates the browser id |
frameId | Indicates the frame id |
isMainFrame | Indicates the whether this is the main frame |
httpStatusCode | The HTTP status code |
|
signal |
Gets called on loading failed due to error.
browserId | Indicates the browser id |
frameId | Indicates the frame id |
isMainFrame | Indicates the whether this is the main frame |
errorCode | The error code |
errorMsg | The error message |
failedUrl | The url caused the failure |
|
signal |
Gets called on draggable region changed.
draggableRegion | The new draggable region |
nonDraggableRegion | The new non-draggable region |
|
signal |
Gets called on the address changed.
frameId | The frame id |
url | The address |
|
signal |
Gets called on title changed.
title | The title |
|
signal |
Gets called on favicon url changed.
urls | The urls |
|
signal |
Gets called on fullscreen mode changed.
fullscreen | The current fullscreen mode |
|
signal |
Gets called on status message changed.
message | The status message |
|
signal |
Gets called on console message from the web content.
message | The message |
level | The level |
|
signal |
Gets called on loading progress changed.
progress | Current progress |
|
signal |
Gets called on built-in scheme URL access.
browserId | The browser id |
frameId | The frame id |
url | The full url |
|
signal |
Gets called on new QCefQuery request.
browserId | The browser id |
frameId | The frame id |
query | The query request |
|
signal |
Gets called on invoking method request from web content(Javascript)
browserId | The browser id |
frameId | The frame id |
method | The method name |
arguments | The arguments list |
|
signal |
Gets called on the result of the javascript executed with executeJavascriptWithResult returned.
browserId | The browser id |
frameId | The frame id |
context | The context |
result | The result |
|
signal |
Gets called after the native browser window created. This slot does not work for OSR mode.
window | The native browser windows |
|
protectedvirtual |
Gets called before a new browser created (only for browser created by non-JavaScript)
sourceFrameId | The source frame id |
url | The target URL |
name | The target name |
targetDisposition | Target window open method |
rect | Rect to be used for the popup |
settings | Settings to be used for the popup |
True to cancel the popup; false to allow
|
protectedvirtual |
Gets called before the popup browser created (only for browser created by JavaScript)
frameId | The source frame id |
targetUrl | The target URL |
targetFrameName | The target name |
targetDisposition | Target window open method |
rect | Rect to be used for the popup |
settings | Settings to be used for the popup |
disableJavascriptAccess | The output value to receive the Javascript access switch |
|
protectedvirtual |
Gets called on new download item was required. Keep reference to the download item and call QCefDownloadItem::start method to allow and start the download, Ignore the download item to disallow the download.
item | The new download item |
suggestedName | The new suggested name |
|
protectedvirtual |
Gets called on download item updated. To get this method called QCefDownloadItem::start method must be called in newDownloadItem method.
item | The download item |
|
protectedvirtual |
Gets called on close request from web.
void QCefView::setFocus | ( | Qt::FocusReason | reason | ) |
Please refer to QWidget::setFocus.
|
override |
Please refer to QWidget::inputMethodQuery.
|
inlineslot |
|
overrideprotected |
Please refer to QWidget::paintEngine.
|
overrideprotected |
event |
|
static |
The main frame identity.
|
static |
The identifier for all frames.