Skip to content

Commit

Permalink
audqt: Hide dotted rectangle around volume slider when focussed
Browse files Browse the repository at this point in the history
See https://stackoverflow.com/q/62258966 for a screenshot.

This still occurs with Qt 6 and various themes on Linux.
Disabling the focus with `slider.setFocusPolicy(Qt.NoFocus)`
is not an option since we want to still handle wheel events.
  • Loading branch information
radioactiveman committed Dec 21, 2023
1 parent fd6f4c4 commit 74dc48c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libaudqt/volumebutton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ class VolumeSliderStyle : public QProxyStyle

return styleHint;
}

void drawPrimitive(PrimitiveElement element,
const QStyleOption * option,
QPainter * painter,
const QWidget * widget) const override
{
/* hide dotted rectangle when slider is focussed */
if (element == QStyle::PE_FrameFocusRect)
return;

QProxyStyle::drawPrimitive(element, option, painter, widget);
}
};

class VolumeButton : public QToolButton
Expand Down

0 comments on commit 74dc48c

Please sign in to comment.