Commit cdcda32a authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Enable persistence of menubar button selection.

parent 6c420c1e
......@@ -22,6 +22,7 @@
#include "dtkWidgetsOverlayPaneSlider.h"
#include <dtkFonts>
#include <dtkTheme>
#include <QtGui/qcolor.h>
......@@ -172,6 +173,11 @@ dtkWidgetsMenuBarButton::dtkWidgetsMenuBarButton(int id, const QString &title, Q
this->setToolTip(title);
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->setMouseTracking(true);
connect(dtkThemesEngine::instance(), &dtkThemesEngine::changed, [=]()
{
dtkThemesEngine::instance()->polish(this);
});
}
void dtkWidgetsMenuBarButton::darken(void)
......@@ -181,7 +187,7 @@ void dtkWidgetsMenuBarButton::darken(void)
this->setPixmap(dtkFontAwesome::instance()->icon(this->icon_id).pixmap(QSize(::size * 3 / 4, ::size * 3 / 4)));
this->setProperty("state", "");
this->setStyleSheet(this->styleSheet()); // This is no bug!
dtkThemesEngine::instance()->polish(this);
}
void dtkWidgetsMenuBarButton::lighten(void)
......@@ -191,7 +197,7 @@ void dtkWidgetsMenuBarButton::lighten(void)
this->setPixmap(dtkFontAwesome::instance()->icon(this->icon_id).pixmap(QSize(::size * 3 / 4, ::size * 3 / 4)));
this->setProperty("state", "current");
this->setStyleSheet(this->styleSheet()); // This is no bug!
dtkThemesEngine::instance()->polish(this);
}
QSize dtkWidgetsMenuBarButton::sizeHint(void) const
......@@ -429,11 +435,10 @@ void dtkWidgetsMenuBarPrivate::touch(void)
if (dtkWidgetsMenuBarButton *button = dynamic_cast<dtkWidgetsMenuBarButton *>(this->layout->itemAt(i)->widget())) {
button->darken();
if (button == b) {
button->lighten();
target = index;
} else {
button->darken();
}
index++;
......
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