File indexing completed on 2024-04-21 03:51:07

0001 /*
0002     SPDX-FileCopyrightText: 2010 Daniel Laidig <laidig@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef PRACTICE_STATUSTOGGLEBUTTON_H
0007 #define PRACTICE_STATUSTOGGLEBUTTON_H
0008 
0009 #include "imagewidget.h"
0010 #include <QDebug> //TODO
0011 
0012 namespace Practice
0013 {
0014 class StatusToggleButton : public ImageWidget
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     StatusToggleButton(QWidget *parent = nullptr)
0020         : ImageWidget(parent)
0021     {
0022         setMouseTracking(true);
0023     }
0024 
0025     void setPixmaps(const QPixmap &defaultPixmap, const QPixmap &hoverPixmap, const QPixmap &pressedPixmap);
0026 
0027 protected:
0028     void mousePressEvent(QMouseEvent *e) override;
0029     void mouseReleaseEvent(QMouseEvent *e) override;
0030     void enterEvent(QEnterEvent *) override;
0031     void leaveEvent(QEvent *) override;
0032 
0033 Q_SIGNALS:
0034     void clicked();
0035 
0036 private:
0037     QPixmap m_defaultPixmap;
0038     QPixmap m_hoverPixmap;
0039     QPixmap m_pressedPixmap;
0040     int m_current{0};
0041 };
0042 }
0043 #endif // PRACTICE_STATUSTOGGLEBUTTON_H