Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[qtmozview] Implement the QuickMozView::loadHtml() stub. Contributes …
…to JB#36017
  • Loading branch information
adenexter committed Mar 16, 2020
1 parent 0801eb3 commit ba4aaae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/qmozview_defined_wrapper.h
Expand Up @@ -139,6 +139,7 @@ Q_DECLARE_METATYPE(QMozReturnValue) \

#define Q_MOZ_VIEW_PUBLIC_SLOTS \
void loadHtml(const QString &html, const QUrl &baseUrl = QUrl()); \
void loadText(const QString &text, const QString &mimeType); \
void goBack(); \
void goForward(); \
void stop(); \
Expand Down
12 changes: 9 additions & 3 deletions src/qopenglwebpage.cpp
Expand Up @@ -524,11 +524,17 @@ void QOpenGLWebPage::setMargins(QMargins margins)

void QOpenGLWebPage::loadHtml(const QString &html, const QUrl &baseUrl)
{
#ifdef DEVELOPMENT_BUILD
qCInfo(lcEmbedLiteExt);
#endif
Q_UNUSED(baseUrl);

loadText(html, QStringLiteral("text/html"));
}

void QOpenGLWebPage::loadText(const QString &text, const QString &mimeType)
{
d->load((QLatin1String("data:") + mimeType + QLatin1String(";charset=utf-8,") + QString::fromUtf8(QUrl::toPercentEncoding(text))));
}


void QOpenGLWebPage::goBack()
{
if (!d->mViewInitialized)
Expand Down
11 changes: 8 additions & 3 deletions src/quickmozview.cpp
Expand Up @@ -667,9 +667,14 @@ void QuickMozView::setMargins(QMargins margins)

void QuickMozView::loadHtml(const QString &html, const QUrl &baseUrl)
{
#ifdef DEVELOPMENT_BUILD
qCInfo(lcEmbedLiteExt);
#endif
Q_UNUSED(baseUrl)

loadText(html, QStringLiteral("text/html"));
}

void QuickMozView::loadText(const QString &text, const QString &mimeType)
{
d->load((QLatin1String("data:") + mimeType + QLatin1String(";charset=utf-8,") + QString::fromUtf8(QUrl::toPercentEncoding(text))));
}

void QuickMozView::goBack()
Expand Down

0 comments on commit ba4aaae

Please sign in to comment.