1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 11:02:19 +01:00

ToolButton: Bring back fallbackIcon property

This commit is contained in:
David Rosca 2016-01-24 12:28:58 +01:00
parent 95f10443ef
commit 31508f2907
2 changed files with 16 additions and 0 deletions

View File

@ -63,6 +63,17 @@ void ToolButton::setThemeIcon(const QString &icon)
setIcon(QIcon::fromTheme(m_themeIcon)); setIcon(QIcon::fromTheme(m_themeIcon));
} }
QIcon ToolButton::fallbackIcon() const
{
return icon();
}
void ToolButton::setFallbackIcon(const QIcon &fallbackIcon)
{
if (icon().isNull())
setIcon(fallbackIcon);
}
QIcon ToolButton::icon() const QIcon ToolButton::icon() const
{ {
return QToolButton::icon(); return QToolButton::icon();

View File

@ -33,6 +33,7 @@ class QUPZILLA_EXPORT ToolButton : public QToolButton
Q_PROPERTY(QImage multiIcon READ multiIcon WRITE setMultiIcon) Q_PROPERTY(QImage multiIcon READ multiIcon WRITE setMultiIcon)
Q_PROPERTY(QIcon icon READ icon WRITE setIcon) Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon) Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon)
Q_PROPERTY(QIcon fallbackIcon READ fallbackIcon WRITE setFallbackIcon)
public: public:
explicit ToolButton(QWidget* parent = 0); explicit ToolButton(QWidget* parent = 0);
@ -45,6 +46,10 @@ public:
QString themeIcon() const; QString themeIcon() const;
void setThemeIcon(const QString &icon); void setThemeIcon(const QString &icon);
// FallbackIcon - In case theme doesn't contain ThemeIcon
QIcon fallbackIcon() const;
void setFallbackIcon(const QIcon &fallbackIcon);
// Icon - Standard QToolButton with icon // Icon - Standard QToolButton with icon
QIcon icon() const; QIcon icon() const;
void setIcon(const QIcon &icon); void setIcon(const QIcon &icon);