forked from qt-creator/qt-creator
litehtml: Add method for retrieving current html content
For squish testing. Fixes: QTCREATORBUG-24903 Change-Id: Id9b21c6be306db9b3ed0e70c23923f39fae2d210 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -368,6 +368,7 @@ display: block;
|
|||||||
class QLiteHtmlWidgetPrivate
|
class QLiteHtmlWidgetPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QString html;
|
||||||
DocumentContainerContext context;
|
DocumentContainerContext context;
|
||||||
QUrl url;
|
QUrl url;
|
||||||
DocumentContainer documentContainer;
|
DocumentContainer documentContainer;
|
||||||
@@ -421,6 +422,7 @@ QUrl QLiteHtmlWidget::url() const
|
|||||||
|
|
||||||
void QLiteHtmlWidget::setHtml(const QString &content)
|
void QLiteHtmlWidget::setHtml(const QString &content)
|
||||||
{
|
{
|
||||||
|
d->html = content;
|
||||||
d->documentContainer.setPaintDevice(viewport());
|
d->documentContainer.setPaintDevice(viewport());
|
||||||
d->documentContainer.setDocument(content.toUtf8(), &d->context);
|
d->documentContainer.setDocument(content.toUtf8(), &d->context);
|
||||||
verticalScrollBar()->setValue(0);
|
verticalScrollBar()->setValue(0);
|
||||||
@@ -428,6 +430,11 @@ void QLiteHtmlWidget::setHtml(const QString &content)
|
|||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QLiteHtmlWidget::html() const
|
||||||
|
{
|
||||||
|
return d->html;
|
||||||
|
}
|
||||||
|
|
||||||
QString QLiteHtmlWidget::title() const
|
QString QLiteHtmlWidget::title() const
|
||||||
{
|
{
|
||||||
return d->documentContainer.caption();
|
return d->documentContainer.caption();
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
void setUrl(const QUrl &url);
|
void setUrl(const QUrl &url);
|
||||||
Q_INVOKABLE QUrl url() const;
|
Q_INVOKABLE QUrl url() const;
|
||||||
void setHtml(const QString &content);
|
void setHtml(const QString &content);
|
||||||
|
Q_INVOKABLE QString html() const;
|
||||||
Q_INVOKABLE QString title() const;
|
Q_INVOKABLE QString title() const;
|
||||||
|
|
||||||
void setZoomFactor(qreal scale);
|
void setZoomFactor(qreal scale);
|
||||||
|
|||||||
Reference in New Issue
Block a user