diff --git a/bin/themes/linux/main.css b/bin/themes/linux/main.css index 96860266a..01a1202d8 100644 --- a/bin/themes/linux/main.css +++ b/bin/themes/linux/main.css @@ -201,6 +201,7 @@ IconProvider margin-bottom:2px; margin-right: 2px; qproperty-pixmap: url(images/search-icon.png); + qproperty-themeIcon: "edit-find"; } #websearchbar-searchprovider-comobobox diff --git a/src/lib/tools/clickablelabel.cpp b/src/lib/tools/clickablelabel.cpp index f5932ef5c..dec070270 100644 --- a/src/lib/tools/clickablelabel.cpp +++ b/src/lib/tools/clickablelabel.cpp @@ -18,12 +18,27 @@ #include "clickablelabel.h" #include +#include ClickableLabel::ClickableLabel(QWidget* parent) : QLabel(parent) { } +void ClickableLabel::setThemeIcon(const QString &name) +{ + QIcon icon(name); + + if (!icon.isNull()) { + setPixmap(icon.pixmap(size())); + } +} + +QString ClickableLabel::themeIcon() const +{ + return m_themeIcon; +} + void ClickableLabel::mouseReleaseEvent(QMouseEvent* ev) { if (ev->button() == Qt::LeftButton && rect().contains(ev->pos())) { diff --git a/src/lib/tools/clickablelabel.h b/src/lib/tools/clickablelabel.h index b363e110d..632add982 100644 --- a/src/lib/tools/clickablelabel.h +++ b/src/lib/tools/clickablelabel.h @@ -30,10 +30,14 @@ class QT_QUPZILLA_EXPORT ClickableLabel : public QLabel Q_PROPERTY(QSize fixedsize READ size WRITE setFixedSize) Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth) Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight) + Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon) public: explicit ClickableLabel(QWidget* parent = 0); + void setThemeIcon(const QString &name); + QString themeIcon() const; + signals: void clicked(QPoint); void middleClicked(QPoint); @@ -41,6 +45,8 @@ signals: private: void mouseReleaseEvent(QMouseEvent* ev); + QString m_themeIcon; + }; #endif // CLICKABLELABEL_H