Files
cbh/ElaWidgetTools/ElaToggleSwitch.h
2025-09-19 22:40:52 +08:00

30 lines
787 B
C++

#ifndef ELATOGGLESWITCH_H
#define ELATOGGLESWITCH_H
#include <QWidget>
#include "ElaProperty.h"
class ElaToggleSwitchPrivate;
class ELA_EXPORT ElaToggleSwitch : public QWidget
{
Q_OBJECT
Q_Q_CREATE(ElaToggleSwitch);
public:
explicit ElaToggleSwitch(QWidget* parent = nullptr);
~ElaToggleSwitch() override;
void setIsToggled(bool isToggled);
bool getIsToggled() const;
Q_SIGNALS:
Q_SIGNAL void toggled(bool checked);
protected:
virtual bool event(QEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void mouseReleaseEvent(QMouseEvent* event) override;
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
};
#endif // ELATOGGLESWITCH_H