volume_button.patch
| src/libaudqt/volumebutton.cc | ||
|---|---|---|
| 21 | 21 | |
| 22 | 22 |
#include <QIcon> |
| 23 | 23 |
#include <QMenu> |
| 24 |
#include <QProxyStyle> |
|
| 24 | 25 |
#include <QSlider> |
| 25 | 26 |
#include <QToolButton> |
| 26 | 27 |
#include <QVBoxLayout> |
| ... | ... | |
| 34 | 35 |
namespace audqt |
| 35 | 36 |
{
|
| 36 | 37 | |
| 38 |
class NoFocusStyle : public QProxyStyle |
|
| 39 |
{
|
|
| 40 |
public: |
|
| 41 |
void drawPrimitive(PrimitiveElement element, const QStyleOption * option, |
|
| 42 |
QPainter * painter, const QWidget * widget) const |
|
| 43 |
{
|
|
| 44 |
// Do not draw dotted rectangle when focused |
|
| 45 |
if (element == QStyle::PE_FrameFocusRect) |
|
| 46 |
return; |
|
| 47 | ||
| 48 |
QProxyStyle::drawPrimitive(element, option, painter, widget); |
|
| 49 |
} |
|
| 50 |
}; |
|
| 51 | ||
| 37 | 52 |
class VolumeButton : public QToolButton |
| 38 | 53 |
{
|
| 39 | 54 |
public: |
| ... | ... | |
| 68 | 83 |
m_slider.setMinimumHeight(audqt::sizes.OneInch); |
| 69 | 84 |
m_slider.setRange(0, 100); |
| 70 | 85 | |
| 86 |
auto style = new NoFocusStyle; |
|
| 87 |
style->setParent(&m_slider); |
|
| 88 |
m_slider.setStyle(style); |
|
| 89 | ||
| 71 | 90 |
setUpButton(&m_buttons[0], 1); |
| 72 | 91 |
setUpButton(&m_buttons[1], -1); |
| 73 | 92 | |
