text: ﻿#include "qtcomponentsscrollbar_internal.h"
  
  #include <QEventTransition>
  #include <QPropertyAnimation>
  
  QtComponentsScrollStateMachine::QtComponentsScrollStateMachine(QtComponentsScrollBar* parent)
      : _scrollBar(parent)
      , _focusState(new QState)
      , _blurState(new QState)
  {
      Q_ASSERT(parent);
  
      addState(_focusState);
      addState(_blurState);
      setInitialState(_blurState);
  
      QEventTransition *transition;
  
      transition = new QEventTransition(parent, QEvent::Enter);
      transition->setTargetState(_focusState);
      _blurState->addTransition(transition);
  
      transition = new QEventTransition(parent, QEvent::Leave);
      transition->setTargetState(_blurState);
      _focusState->addTransition(transition);
  
      _focusState->assignProperty(this, "opacity", 1);
      _blurState->assignProperty(this, "opacity", 0);
  
      QPropertyAnimation *animation;
  
      animation = new QPropertyAnimation(this, "opacity", this);
      animation->setDuration(340);
      addDefaultAnimation(animation);
  }
  
  QtComponentsScrollStateMachine::~QtComponentsScrollStateMachine()
  {
  
  }
  