1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

IconProvider: Prefer theme icon for bookmarks

This commit is contained in:
David Rosca 2016-01-27 12:44:19 +01:00
parent 732e0ec94e
commit 2f80ca55ef
3 changed files with 12 additions and 12 deletions

View File

@ -88,12 +88,12 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
// Draw star to bookmark items
int starPixmapWidth = 0;
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
const QPixmap starPixmap = IconProvider::instance()->bookmarkIcon();
QSize starSize = starPixmap.size();
const QIcon icon = IconProvider::instance()->bookmarkIcon();
const QSize starSize(16, 16);
starPixmapWidth = starSize.width();
QPoint pos(rightPosition - starPixmapWidth, opt.rect.top() + m_padding);
QPoint pos(rightPosition - starPixmapWidth, center - starSize.height() / 2);
QRect starRect(pos, starSize);
painter->drawPixmap(starRect, starPixmap);
painter->drawPixmap(starRect, icon.pixmap(starSize));
}
const QString searchText = index.data(LocationCompleterModel::SearchStringRole).toString();

View File

@ -63,14 +63,14 @@ void IconProvider::saveIcon(WebView* view)
m_iconBuffer.append(item);
}
QPixmap IconProvider::bookmarkIcon() const
QIcon IconProvider::bookmarkIcon() const
{
return m_bookmarkIcon;
return QIcon::fromTheme(QSL("bookmarks"), m_bookmarkIcon);
}
void IconProvider::setBookmarkIcon(const QPixmap &pixmap)
void IconProvider::setBookmarkIcon(const QIcon &icon)
{
m_bookmarkIcon = pixmap;
m_bookmarkIcon = icon;
}
QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon)

View File

@ -34,15 +34,15 @@ class AutoSaver;
class QUPZILLA_EXPORT IconProvider : public QWidget
{
Q_OBJECT
Q_PROPERTY(QPixmap bookmarkIcon READ bookmarkIcon WRITE setBookmarkIcon)
Q_PROPERTY(QIcon bookmarkIcon READ bookmarkIcon WRITE setBookmarkIcon)
public:
explicit IconProvider();
void saveIcon(WebView* view);
QPixmap bookmarkIcon() const;
void setBookmarkIcon(const QPixmap &pixmap);
QIcon bookmarkIcon() const;
void setBookmarkIcon(const QIcon &icon);
// QStyle equivalent
static QIcon standardIcon(QStyle::StandardPixmap icon);
@ -76,7 +76,7 @@ private:
QIcon iconFromImage(const QImage &image);
QImage m_emptyWebImage;
QPixmap m_bookmarkIcon;
QIcon m_bookmarkIcon;
QVector<BufferedIcon> m_iconBuffer;
AutoSaver* m_autoSaver;