1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

[Linux theme] New icon for search button in searchbar.

Use "edit-find" icon for theme, if there is no such
icon, the old one will be used.
This commit is contained in:
nowrep 2013-01-21 22:39:20 +01:00
parent 992c7a4de1
commit 6ebfee73ba
3 changed files with 22 additions and 0 deletions

View File

@ -201,6 +201,7 @@ IconProvider
margin-bottom:2px; margin-bottom:2px;
margin-right: 2px; margin-right: 2px;
qproperty-pixmap: url(images/search-icon.png); qproperty-pixmap: url(images/search-icon.png);
qproperty-themeIcon: "edit-find";
} }
#websearchbar-searchprovider-comobobox #websearchbar-searchprovider-comobobox

View File

@ -18,12 +18,27 @@
#include "clickablelabel.h" #include "clickablelabel.h"
#include <QMouseEvent> #include <QMouseEvent>
#include <QIcon>
ClickableLabel::ClickableLabel(QWidget* parent) ClickableLabel::ClickableLabel(QWidget* parent)
: QLabel(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) void ClickableLabel::mouseReleaseEvent(QMouseEvent* ev)
{ {
if (ev->button() == Qt::LeftButton && rect().contains(ev->pos())) { if (ev->button() == Qt::LeftButton && rect().contains(ev->pos())) {

View File

@ -30,10 +30,14 @@ class QT_QUPZILLA_EXPORT ClickableLabel : public QLabel
Q_PROPERTY(QSize fixedsize READ size WRITE setFixedSize) Q_PROPERTY(QSize fixedsize READ size WRITE setFixedSize)
Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth) Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth)
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight) Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon)
public: public:
explicit ClickableLabel(QWidget* parent = 0); explicit ClickableLabel(QWidget* parent = 0);
void setThemeIcon(const QString &name);
QString themeIcon() const;
signals: signals:
void clicked(QPoint); void clicked(QPoint);
void middleClicked(QPoint); void middleClicked(QPoint);
@ -41,6 +45,8 @@ signals:
private: private:
void mouseReleaseEvent(QMouseEvent* ev); void mouseReleaseEvent(QMouseEvent* ev);
QString m_themeIcon;
}; };
#endif // CLICKABLELABEL_H #endif // CLICKABLELABEL_H