代码拉取完成,页面将自动刷新
#include "qtmaterialautocomplete_internal.h"
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
#include <QSignalTransition>
/*!
* \class QtMaterialAutoCompleteStateMachine
* \internal
*/
/*!
* \internal
*/
QtMaterialAutoCompleteStateMachine::QtMaterialAutoCompleteStateMachine(QWidget *menu)
: QStateMachine(menu),
m_menu(menu),
m_closedState(new QState),
m_openState(new QState),
m_closingState(new QState)
{
Q_ASSERT(menu);
addState(m_closedState);
addState(m_openState);
addState(m_closingState);
setInitialState(m_closedState);
QSignalTransition *transition;
transition = new QSignalTransition(this, &QtMaterialAutoCompleteStateMachine::shouldOpen);
transition->setTargetState(m_openState);
m_closedState->addTransition(transition);
transition = new QSignalTransition(this, &QtMaterialAutoCompleteStateMachine::shouldClose);
transition->setTargetState(m_closedState);
m_openState->addTransition(transition);
transition = new QSignalTransition(this, &QtMaterialAutoCompleteStateMachine::shouldFade);
transition->setTargetState(m_closingState);
m_openState->addTransition(transition);
m_closedState->assignProperty(menu, "visible", false);
m_openState->assignProperty(menu, "visible", true);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
menu->setGraphicsEffect(effect);
m_openState->assignProperty(effect, "opacity", 1);
m_closingState->assignProperty(effect, "opacity", 0);
m_closedState->assignProperty(effect, "opacity", 0);
QPropertyAnimation *animation;
animation = new QPropertyAnimation(effect, "opacity", this);
animation->setDuration(240);
addDefaultAnimation(animation);
transition = new QSignalTransition(animation, &QPropertyAnimation::finished);
transition->setTargetState(m_closedState);
m_closingState->addTransition(transition);
}
/*!
* \internal
*/
QtMaterialAutoCompleteStateMachine::~QtMaterialAutoCompleteStateMachine()
{
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。