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:
parent
732e0ec94e
commit
2f80ca55ef
|
@ -88,12 +88,12 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
|
||||||
// Draw star to bookmark items
|
// Draw star to bookmark items
|
||||||
int starPixmapWidth = 0;
|
int starPixmapWidth = 0;
|
||||||
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
|
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
|
||||||
const QPixmap starPixmap = IconProvider::instance()->bookmarkIcon();
|
const QIcon icon = IconProvider::instance()->bookmarkIcon();
|
||||||
QSize starSize = starPixmap.size();
|
const QSize starSize(16, 16);
|
||||||
starPixmapWidth = starSize.width();
|
starPixmapWidth = starSize.width();
|
||||||
QPoint pos(rightPosition - starPixmapWidth, opt.rect.top() + m_padding);
|
QPoint pos(rightPosition - starPixmapWidth, center - starSize.height() / 2);
|
||||||
QRect starRect(pos, starSize);
|
QRect starRect(pos, starSize);
|
||||||
painter->drawPixmap(starRect, starPixmap);
|
painter->drawPixmap(starRect, icon.pixmap(starSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString searchText = index.data(LocationCompleterModel::SearchStringRole).toString();
|
const QString searchText = index.data(LocationCompleterModel::SearchStringRole).toString();
|
||||||
|
|
|
@ -63,14 +63,14 @@ void IconProvider::saveIcon(WebView* view)
|
||||||
m_iconBuffer.append(item);
|
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)
|
QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon)
|
||||||
|
|
|
@ -34,15 +34,15 @@ class AutoSaver;
|
||||||
class QUPZILLA_EXPORT IconProvider : public QWidget
|
class QUPZILLA_EXPORT IconProvider : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QPixmap bookmarkIcon READ bookmarkIcon WRITE setBookmarkIcon)
|
Q_PROPERTY(QIcon bookmarkIcon READ bookmarkIcon WRITE setBookmarkIcon)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IconProvider();
|
explicit IconProvider();
|
||||||
|
|
||||||
void saveIcon(WebView* view);
|
void saveIcon(WebView* view);
|
||||||
|
|
||||||
QPixmap bookmarkIcon() const;
|
QIcon bookmarkIcon() const;
|
||||||
void setBookmarkIcon(const QPixmap &pixmap);
|
void setBookmarkIcon(const QIcon &icon);
|
||||||
|
|
||||||
// QStyle equivalent
|
// QStyle equivalent
|
||||||
static QIcon standardIcon(QStyle::StandardPixmap icon);
|
static QIcon standardIcon(QStyle::StandardPixmap icon);
|
||||||
|
@ -76,7 +76,7 @@ private:
|
||||||
QIcon iconFromImage(const QImage &image);
|
QIcon iconFromImage(const QImage &image);
|
||||||
|
|
||||||
QImage m_emptyWebImage;
|
QImage m_emptyWebImage;
|
||||||
QPixmap m_bookmarkIcon;
|
QIcon m_bookmarkIcon;
|
||||||
QVector<BufferedIcon> m_iconBuffer;
|
QVector<BufferedIcon> m_iconBuffer;
|
||||||
|
|
||||||
AutoSaver* m_autoSaver;
|
AutoSaver* m_autoSaver;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user