log isChecked status to figure out weird Toggle animation behavior
This commit is contained in:
parent
7c2c6c56d0
commit
db3439f604
|
@ -55,14 +55,15 @@ void Thumb::mouseReleaseEvent(QMouseEvent *event)
|
|||
Q_UNUSED(event)
|
||||
|
||||
const bool checked = _toggle->isChecked();
|
||||
_toggle->setChecked(!checked);
|
||||
_animation->setDirection(checked
|
||||
? QAbstractAnimation::Forward
|
||||
: QAbstractAnimation::Backward);
|
||||
if (QAbstractAnimation::Running != _animation->state()) {
|
||||
_animation->setEasingCurve(checked
|
||||
? QEasingCurve::OutCubic
|
||||
: QEasingCurve::InCubic);
|
||||
}
|
||||
// if (QAbstractAnimation::Running != _animation->state()) {
|
||||
// _animation->setEasingCurve(checked
|
||||
// ? QEasingCurve::OutCubic
|
||||
// : QEasingCurve::InCubic);
|
||||
// }
|
||||
_animation->start();
|
||||
|
||||
emit clicked();
|
||||
|
@ -107,8 +108,10 @@ Toggle::Toggle(QWidget *parent)
|
|||
_thumb->setGraphicsEffect(effect);
|
||||
_thumb->installEventFilter(this);
|
||||
|
||||
connect(_thumb, SIGNAL(clicked()), this, SLOT(toggle()));
|
||||
connect(_thumb, SIGNAL(clicked()), this, SLOT(addRipple()));
|
||||
|
||||
connect(_thumb, SIGNAL(clicked()), this, SLOT(logCheckedStatus()));
|
||||
|
||||
connect(_thumb, SIGNAL(progressChanged(qreal)), this, SLOT(updateOverlayGeometry()));
|
||||
}
|
||||
|
||||
|
@ -116,6 +119,11 @@ Toggle::~Toggle()
|
|||
{
|
||||
}
|
||||
|
||||
void Toggle::logCheckedStatus()
|
||||
{
|
||||
qDebug() << "checked : " << isChecked();
|
||||
}
|
||||
|
||||
QSize Toggle::sizeHint() const
|
||||
{
|
||||
return Qt::Horizontal == _orientation
|
||||
|
|
|
@ -55,12 +55,14 @@ public:
|
|||
protected slots:
|
||||
void addRipple();
|
||||
void updateOverlayGeometry();
|
||||
void logCheckedStatus();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Thumb *const _thumb;
|
||||
RippleOverlay *const _overlay;
|
||||
Qt::Orientation _orientation;
|
||||
|
|
Loading…
Reference in New Issue