Commit cb23584f authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

use theme for item button

parent 852dbd93
......@@ -19,6 +19,7 @@
#include "dtkWidgetsWidget.h"
#include <dtkFonts>
#include <dtkThemes>
#include <QtCore>
#include <QtWidgets>
......@@ -42,14 +43,17 @@ public:
QSize sizeHint(void) const;
protected:
void mousePressEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *) override;
void paintEvent(QPaintEvent *) override;
private:
fa::icon m_icon;
};
dtkWidgetsLayoutItemButton::dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent) : QLabel(parent)
{
dtkFontAwesome::instance()->initFontAwesome();
this->setPixmap(dtkFontAwesome::instance()->icon(icon).pixmap(this->sizeHint()));
this->m_icon = icon;
}
dtkWidgetsLayoutItemButton::~dtkWidgetsLayoutItemButton(void)
......@@ -67,6 +71,15 @@ void dtkWidgetsLayoutItemButton::mousePressEvent(QMouseEvent *)
emit clicked();
}
void dtkWidgetsLayoutItemButton::paintEvent(QPaintEvent *event)
{
QLabel::paintEvent(event);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@fg"));
this->setPixmap(dtkFontAwesome::instance()->icon(m_icon).pixmap(this->sizeHint()));
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsLayoutItemProxy
// ///////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment