qt-material-widgets/components/qtmaterialcheckbox.cpp

83 lines
2.1 KiB
C++
Raw Normal View History

2017-09-29 06:53:21 +00:00
#include "qtmaterialcheckbox.h"
2022-07-15 06:10:33 +00:00
#include "materiallib/qtmaterialcheckable_internal.h"
2017-09-29 06:53:21 +00:00
#include "qtmaterialcheckbox_p.h"
#include <QPropertyAnimation>
#include <QSignalTransition>
#include <QState>
/*!
* \class QtMaterialCheckBoxPrivate
* \internal
*/
/*!
* \internal
*/
QtMaterialCheckBoxPrivate::QtMaterialCheckBoxPrivate(QtMaterialCheckBox *q)
: QtMaterialCheckablePrivate(q)
2022-07-15 05:54:20 +00:00
, q_ptr(q)
2017-09-29 06:53:21 +00:00
{
}
/*!
* \internal
*/
2022-07-05 07:49:55 +00:00
QtMaterialCheckBoxPrivate::~QtMaterialCheckBoxPrivate() {}
2017-09-29 06:53:21 +00:00
/*!
* \internal
*/
void QtMaterialCheckBoxPrivate::init()
{
Q_Q(QtMaterialCheckBox);
checkedState->assignProperty(checkedIcon, "iconSize", 24);
uncheckedState->assignProperty(checkedIcon, "iconSize", 0);
QPropertyAnimation *animation;
animation = new QPropertyAnimation(checkedIcon, "iconSize", q);
animation->setDuration(300);
uncheckedTransition->addAnimation(animation);
animation = new QPropertyAnimation(checkedIcon, "iconSize", q);
animation->setDuration(1300);
checkedTransition->addAnimation(animation);
animation = new QPropertyAnimation(checkedIcon, "opacity", q);
animation->setDuration(440);
checkedTransition->addAnimation(animation);
animation = new QPropertyAnimation(checkedIcon, "opacity", q);
animation->setDuration(440);
uncheckedTransition->addAnimation(animation);
animation = new QPropertyAnimation(uncheckedIcon, "opacity", q);
animation->setDuration(440);
checkedTransition->addAnimation(animation);
animation = new QPropertyAnimation(uncheckedIcon, "opacity", q);
animation->setDuration(440);
uncheckedTransition->addAnimation(animation);
animation = new QPropertyAnimation(uncheckedIcon, "color", q);
animation->setDuration(440);
checkedTransition->addAnimation(animation);
animation = new QPropertyAnimation(uncheckedIcon, "color", q);
animation->setDuration(440);
uncheckedTransition->addAnimation(animation);
}
/*!
* \class QtMaterialCheckBox
*/
QtMaterialCheckBox::QtMaterialCheckBox(QWidget *parent)
: QtMaterialCheckable(*new QtMaterialCheckBoxPrivate(this), parent)
{
d_func()->init();
}
2022-07-05 07:49:55 +00:00
QtMaterialCheckBox::~QtMaterialCheckBox() {}