summaryrefslogtreecommitdiffstats
path: root/src/widget/wpushbutton.cpp
diff options
context:
space:
mode:
authorronso0 <ronso0@mixxx.org>2020-02-02 17:18:14 +0100
committerronso0 <ronso0@mixxx.org>2020-02-02 17:18:14 +0100
commit8beb1dfc2580044c45e3c98e20751c12afbb5ca7 (patch)
treec0195d46ce942ded4ca978f47d012b758b2fcec3 /src/widget/wpushbutton.cpp
parent9f61e15ebb203a3d88eb94e80782cfcc952710c1 (diff)
WPushButton: override hover property to also repaint its text label
Diffstat (limited to 'src/widget/wpushbutton.cpp')
-rw-r--r--src/widget/wpushbutton.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/widget/wpushbutton.cpp b/src/widget/wpushbutton.cpp
index 613b4bbe51..0b6ef0bc22 100644
--- a/src/widget/wpushbutton.cpp
+++ b/src/widget/wpushbutton.cpp
@@ -70,7 +70,7 @@ void WPushButton::setup(const QDomNode& node, const SkinContext& context) {
}
}
- // Load pixmaps for associated states
+ // Load pixmaps and set texts for associated states
QDomNode state = context.selectNode(node, "State");
while (!state.isNull()) {
if (state.isElement() && state.nodeName() == "State") {
@@ -227,6 +227,7 @@ void WPushButton::setup(const QDomNode& node, const SkinContext& context) {
}
void WPushButton::setStates(int iStates) {
+ m_bHovered = false;
m_bPressed = false;
m_iNoStates = iStates;
m_activeTouchButton = Qt::NoButton;
@@ -341,6 +342,18 @@ void WPushButton::paintEvent(QPaintEvent* e) {
}
}
+void WPushButton::enterEvent(QEvent *event) {
+ m_bHovered = true;
+ restyleAndRepaint();
+ return QWidget::enterEvent(event);
+}
+
+void WPushButton::leaveEvent(QEvent *event) {
+ m_bHovered = false;
+ restyleAndRepaint();
+ return QWidget::leaveEvent(event);
+}
+
void WPushButton::mousePressEvent(QMouseEvent * e) {
const bool leftClick = e->button() == Qt::LeftButton;
const bool rightClick = e->button() == Qt::RightButton;