1 /* SPDX-License-Identifier: GPL-2.0-only */
8 #include <QSvgRenderer>
12 * The ToggleSwitch class represents Toggle Switch widget based on QCheckBox and toggles svg with colorscheme support
14 class ToggleSwitch
: public QCheckBox
{
17 explicit ToggleSwitch(QWidget
* parent
= nullptr);
22 static const QByteArray s_toggleOnSvgContent
;
23 static const QByteArray s_toggleOffSvgContent
;
24 static const int s_colorPosInToggleOn
;
26 QByteArray m_toggleOnSvgContentColored
;
28 /* QWidget interface */
30 void paintEvent(QPaintEvent
*event
) override
;
32 /* QAbstractButton interface */
34 bool hitButton(const QPoint
&pos
) const override
36 /* needs to be clickable on */
37 return rect().contains(pos
);