File indexing completed on 2022-01-30 18:32:30

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Evan Teran <evan.teran@gmail.com>
0003     SPDX-FileCopyrightText: 2006 Michel Marti <mma@objectxp.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QAbstractButton>
0011 
0012 class BitButton : public QAbstractButton
0013 {
0014     Q_OBJECT
0015 
0016 public:
0017     explicit BitButton(QWidget *parent = nullptr);
0018     Q_REQUIRED_RESULT bool isOn() const;
0019     void setOn(bool value);
0020     void setRenderSize(const QSize &size);
0021     QSize renderSize() const;
0022 
0023 protected:
0024     void paintEvent(QPaintEvent *event) override;
0025 
0026 private:
0027 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0028     void enterEvent(QEnterEvent *event) override;
0029 #else
0030     void enterEvent(QEvent *event) override;
0031 #endif
0032     void leaveEvent(QEvent *event) override;
0033     bool on_ = false;
0034     bool over_ = false;
0035     QSize renderSize_;
0036 };
0037