File indexing completed on 2024-05-19 05:28:49
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "breezespinboxdata.h" 0008 0009 namespace Breeze 0010 { 0011 //________________________________________________ 0012 SpinBoxData::SpinBoxData(QObject *parent, QObject *target, int duration) 0013 : AnimationData(parent, target) 0014 { 0015 _upArrowData._animation = new Animation(duration, this); 0016 _downArrowData._animation = new Animation(duration, this); 0017 setupAnimation(upArrowAnimation(), "upArrowOpacity"); 0018 setupAnimation(downArrowAnimation(), "downArrowOpacity"); 0019 } 0020 0021 //______________________________________________ 0022 bool SpinBoxData::Data::updateState(bool value) 0023 { 0024 if (_state == value) { 0025 return false; 0026 } else { 0027 _state = value; 0028 _animation.data()->setDirection(_state ? Animation::Forward : Animation::Backward); 0029 if (!_animation.data()->isRunning()) { 0030 _animation.data()->start(); 0031 } 0032 return true; 0033 } 0034 } 0035 0036 }