diff --git a/src/lib/tools/toolbutton.cpp b/src/lib/tools/toolbutton.cpp index ff25df97f..9a8b71062 100644 --- a/src/lib/tools/toolbutton.cpp +++ b/src/lib/tools/toolbutton.cpp @@ -63,6 +63,17 @@ void ToolButton::setThemeIcon(const QString &icon) 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 { return QToolButton::icon(); diff --git a/src/lib/tools/toolbutton.h b/src/lib/tools/toolbutton.h index 9e31d7048..813316a55 100644 --- a/src/lib/tools/toolbutton.h +++ b/src/lib/tools/toolbutton.h @@ -33,6 +33,7 @@ class QUPZILLA_EXPORT ToolButton : public QToolButton Q_PROPERTY(QImage multiIcon READ multiIcon WRITE setMultiIcon) Q_PROPERTY(QIcon icon READ icon WRITE setIcon) Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon) + Q_PROPERTY(QIcon fallbackIcon READ fallbackIcon WRITE setFallbackIcon) public: explicit ToolButton(QWidget* parent = 0); @@ -45,6 +46,10 @@ public: QString themeIcon() const; 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 QIcon icon() const; void setIcon(const QIcon &icon);