代码拉取完成,页面将自动刷新
#ifndef QTMATERIALSWITCH_INTERNAL_H
#define QTMATERIALSWITCH_INTERNAL_H
#include "lib/qtmaterialrippleoverlay.h"
#include <QWidget>
class QtMaterialSwitch;
class QtMaterialSwitchThumb;
class QtMaterialSwitchTrack;
class QtMaterialSwitchRippleOverlay : public QtMaterialRippleOverlay
{
Q_OBJECT
public:
QtMaterialSwitchRippleOverlay(QtMaterialSwitchThumb *thumb, QtMaterialSwitchTrack *track, QtMaterialSwitch *parent);
~QtMaterialSwitchRippleOverlay() override;
protected slots:
void addSwitchRipple();
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
QRect overlayGeometry() const override;
private:
Q_DISABLE_COPY(QtMaterialSwitchRippleOverlay)
QtMaterialSwitch *const m_switch;
QtMaterialSwitchThumb *const m_thumb;
QtMaterialSwitchTrack *const m_track;
};
class QtMaterialSwitchThumb : public QWidget
{
Q_OBJECT
Q_PROPERTY(qreal shift WRITE setShift READ shift)
Q_PROPERTY(QColor thumbColor WRITE setThumbColor READ thumbColor)
public:
QtMaterialSwitchThumb(QtMaterialSwitch *parent);
~QtMaterialSwitchThumb() override;
void setShift(qreal shift);
inline qreal shift() const;
inline qreal offset() const;
inline void setThumbColor(const QColor &color);
inline QColor thumbColor() const;
private:
Q_DISABLE_COPY(QtMaterialSwitchThumb)
void updateOffset();
QtMaterialSwitch *const m_switch;
QColor m_thumbColor;
qreal m_shift;
qreal m_offset;
// QWidget interface
protected:
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
};
inline qreal QtMaterialSwitchThumb::shift() const
{
return m_shift;
}
inline qreal QtMaterialSwitchThumb::offset() const
{
return m_offset;
}
inline void QtMaterialSwitchThumb::setThumbColor(const QColor &color)
{
m_thumbColor = color;
update();
}
inline QColor QtMaterialSwitchThumb::thumbColor() const
{
return m_thumbColor;
}
class QtMaterialSwitchTrack : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
public:
QtMaterialSwitchTrack(QtMaterialSwitch *parent);
~QtMaterialSwitchTrack() override;
void setTrackColor(const QColor &color);
inline QColor trackColor() const;
private:
Q_DISABLE_COPY(QtMaterialSwitchTrack)
QtMaterialSwitch *const m_switch;
QColor m_trackColor;
// QWidget interface
protected:
void paintEvent(QPaintEvent *event) override;
};
inline QColor QtMaterialSwitchTrack::trackColor() const
{
return m_trackColor;
}
#endif // QTMATERIALSWITCH_INTERNAL_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。