Commit 3e3e357e authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Disconnect menubar button when deleted.

parent cdcda32a
......@@ -33,14 +33,14 @@ class dtkWidgetsLayoutItemButton : public QFrame
Q_OBJECT
public:
dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent = Q_NULLPTR);
dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent = nullptr);
~dtkWidgetsLayoutItemButton(void);
signals:
void clicked(void);
public:
QSize sizeHint(void) const;
QSize sizeHint(void) const override;
protected:
void mousePressEvent(QMouseEvent *) override;
......
......@@ -174,12 +174,17 @@ dtkWidgetsMenuBarButton::dtkWidgetsMenuBarButton(int id, const QString &title, Q
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->setMouseTracking(true);
connect(dtkThemesEngine::instance(), &dtkThemesEngine::changed, [=]()
m_connection = connect(dtkThemesEngine::instance(), &dtkThemesEngine::changed, [=]()
{
dtkThemesEngine::instance()->polish(this);
});
}
dtkWidgetsMenuBarButton::~dtkWidgetsMenuBarButton(void)
{
disconnect(m_connection);
}
void dtkWidgetsMenuBarButton::darken(void)
{
dtkFontAwesome::instance()->setDefaultOption("color", QColor("#999999"));
......
......@@ -39,7 +39,8 @@ class dtkWidgetsMenuBarButton : public QLabel
Q_OBJECT
public:
dtkWidgetsMenuBarButton(int id, const QString &title, QWidget *parent = nullptr);
dtkWidgetsMenuBarButton(int id, const QString &title, QWidget *parent = nullptr);
~dtkWidgetsMenuBarButton(void);
signals:
void clicked(void);
......@@ -59,6 +60,7 @@ public:
private:
int icon_id = 0;
QMetaObject::Connection m_connection;
};
// /////////////////////////////////////////////////////////////////////////////
......
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