better placeholder icon
This commit is contained in:
parent
8adf3061fe
commit
3360ca8d6e
Binary file not shown.
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 9.8 KiB |
@ -443,7 +443,9 @@ void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& base_url
|
||||
emit pageUrlChanged(base_url);
|
||||
}
|
||||
|
||||
TextBrowserDocument::TextBrowserDocument(QObject* parent) : QTextDocument(parent), m_reloadingWithResources(false) {}
|
||||
TextBrowserDocument::TextBrowserDocument(QObject* parent)
|
||||
: QTextDocument(parent), m_reloadingWithResources(false),
|
||||
m_placeholderImage(qApp->icons()->miscPixmap("image-placeholder")) {}
|
||||
|
||||
QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
||||
if (!m_reloadingWithResources) {
|
||||
@ -451,12 +453,12 @@ QVariant TextBrowserDocument::loadResource(int type, const QUrl& name) {
|
||||
m_neededResourcesForHtml.append(name);
|
||||
}
|
||||
|
||||
return {};
|
||||
return m_placeholderImage;
|
||||
}
|
||||
else if (m_loadedResources.contains(name)) {
|
||||
return QImage::fromData(m_loadedResources.value(name));
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
return m_placeholderImage;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "network-web/adblock/adblockmanager.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
|
||||
class QContextMenuEvent;
|
||||
@ -31,6 +32,7 @@ class TextBrowserDocument : public QTextDocument {
|
||||
bool m_reloadingWithResources;
|
||||
QList<QUrl> m_neededResourcesForHtml;
|
||||
QMap<QUrl, QByteArray> m_loadedResources;
|
||||
QPixmap m_placeholderImage;
|
||||
};
|
||||
|
||||
class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
||||
|
Loading…
x
Reference in New Issue
Block a user