1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Don't use async icon loading in history/bookmarks models

Sometimes it crashes, needs more investigation, but this seems
to fix it.
Bookmarks icons are still loaded only when shown inside the view.
This commit is contained in:
David Rosca 2016-12-20 11:14:31 +01:00
parent d19f5de7bf
commit bb25bb8593
2 changed files with 2 additions and 6 deletions

View File

@ -297,9 +297,7 @@ void BookmarksTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &o
if (itemIsUrl && !iconLoaded) {
const QPersistentModelIndex idx = index;
IconProvider::imageForUrlAsync(index.data(BookmarksModel::UrlRole).toUrl(), this, [=](const QImage &img) {
model()->setData(idx, QIcon(QPixmap::fromImage(img)), BookmarksModel::IconRole);
});
model()->setData(idx, IconProvider::iconForUrl(index.data(BookmarksModel::UrlRole).toUrl()), BookmarksModel::IconRole);
}
QTreeView::drawRow(painter, options, index);

View File

@ -259,9 +259,7 @@ void HistoryTreeView::drawRow(QPainter* painter, const QStyleOptionViewItem &opt
if (index.isValid() && !itemTopLevel && !iconLoaded) {
const QPersistentModelIndex idx = index;
IconProvider::imageForUrlAsync(index.data(HistoryModel::UrlRole).toUrl(), this, [=](const QImage &img) {
model()->setData(idx, QIcon(QPixmap::fromImage(img)), HistoryModel::IconRole);
});
model()->setData(idx, IconProvider::iconForUrl(index.data(HistoryModel::UrlRole).toUrl()), HistoryModel::IconRole);
}
QTreeView::drawRow(painter, options, index);