21 #include "qgis_core.h"
32 #include <QNetworkAccessManager>
34 #include <QTextBrowser>
55 PrivateBrowsingEnabled,
56 JavascriptCanOpenWindows,
57 JavascriptCanAccessClipboard,
58 DeveloperExtrasEnabled,
59 LinksIncludedInFocusChain,
61 PrintElementBackgrounds,
62 OfflineStorageDatabaseEnabled,
63 OfflineWebApplicationCacheEnabled,
65 LocalContentCanAccessRemoteUrls,
68 AcceleratedCompositingEnabled,
69 SpatialNavigationEnabled,
70 LocalContentCanAccessFileUrls,
71 TiledBackingStoreEnabled,
72 FrameFlatteningEnabled,
73 SiteSpecificQuirksEnabled,
74 JavascriptCanCloseWindows,
77 HyperlinkAuditingEnabled,
79 ScrollAnimatorEnabled,
88 void setUserStyleSheetUrl(
const QUrl & )
92 void setAttribute( WebAttribute,
bool )
110 enum LinkDelegationPolicy
113 DelegateExternalLinks,
123 explicit QWebPage( QObject *parent =
nullptr )
128 connect( mFrame, &QWebFrame::loadFinished,
this, &QWebPage::loadFinished );
137 QPalette palette()
const
142 void setPalette(
const QPalette &palette )
147 void setViewportSize(
const QSize &size )
const
152 void setLinkDelegationPolicy( LinkDelegationPolicy linkDelegationPolicy )
157 QTextBrowser *tb = qobject_cast<QTextBrowser *>( parent() );
161 tb->setOpenExternalLinks( linkDelegationPolicy != DontDelegateLinks );
164 void setNetworkAccessManager( QNetworkAccessManager *networkAccessManager )
166 Q_UNUSED( networkAccessManager )
179 QSize viewportSize()
const
184 QMenu *createStandardContextMenu()
191 void loadFinished(
bool ok );
193 void downloadRequested(
const QNetworkRequest &request );
195 void unsupportedContent( QNetworkReply *reply );
201 virtual void javaScriptConsoleMessage(
const QString &,
int,
const QString & ) {}
238 void setIdentifier(
const QString &identifier ) { mIdentifier = identifier; }
251 if ( mIdentifier.isEmpty() )
254 QgsMessageLog::logMessage( tr(
"%1 (line %2): %3" ).arg( mIdentifier ).arg( lineNumber ).arg( message ), tr(
"JavaScript" ) );
The QWebFrame class is a collection of stubs to mimic the API of a QWebFrame on systems where QtWebki...
The QWebPage class is a collection of stubs to mimic the API of a QWebPage on systems where QtWebkit ...
The QWebSettings class is a collection of stubs to mimic the API of a QWebSettings on systems where Q...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QWebPage subclass which redirects JavaScript errors and console output to the QGIS message log.
QgsWebPage(QObject *parent=nullptr)
Constructor for QgsWebPage.
void javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &) override
void setIdentifier(const QString &identifier)
Sets an identifier for the QgsWebPage.
QString identifier() const
Returns the QgsWebPage's identifier.