1 | /* |
2 | SPDX-FileCopyrightText: 2012-2013 Evan Teran <evan.teran@gmail.com> |
3 | SPDX-FileCopyrightText: 2006 Michel Marti <mma@objectxp.com> |
4 | |
5 | SPDX-License-Identifier: GPL-2.0-or-later |
6 | */ |
7 | |
8 | #pragma once |
9 | |
10 | #include <QAbstractButton> |
11 | |
12 | class BitButton : public QAbstractButton |
13 | { |
14 | Q_OBJECT |
15 | |
16 | public: |
17 | explicit BitButton(QWidget *parent = nullptr); |
18 | Q_REQUIRED_RESULT bool isOn() const; |
19 | void setOn(bool value); |
20 | void setRenderSize(const QSize &size); |
21 | QSize renderSize() const; |
22 | |
23 | protected: |
24 | void paintEvent(QPaintEvent *event) override; |
25 | |
26 | private: |
27 | void enterEvent(QEnterEvent *event) override; |
28 | void focusInEvent(QFocusEvent *event) override; |
29 | void focusOutEvent(QFocusEvent *event) override; |
30 | void leaveEvent(QEvent *event) override; |
31 | bool on_ = false; |
32 | bool over_ = false; |
33 | QSize renderSize_; |
34 | }; |
35 | |
36 | |